MySQL comparison Query

Source: Internet
Author: User
Tags dname
  1. MySQL --------
  2. Select a. dname,
  3. Max (If(B. Mon ='February', B. YJ,0) In March,
  4. Max (If(B. Mon ='February', B. YJ,0) In March,
  5. Max (If(B. Mon ='February', B. YJ,0) February
  6. From T2 a left join t1 B on A. Dep = B. Dep
  7. Group by dname
  8. MySQL -------
  9. Select a. dname,
  10. Sum (CaseWhen B. Mon ='February'Then B. YJElse 0End) in March,
  11. Sum (CaseWhen B. Mon ='February'Then B. YJElse 0End) in March,
  12. Sum (CaseWhen B. Mon ='February'Then B. YJElse 0End) January
  13. From T2 a left join t1 B on A. Dep = B. Dep
  14. Group by dname
  15. Oracle ------ note: the decode method is different from that of MySQL.
  16. Select a. dname,
  17. Max (decode (B. Mon,'February', B. YJ,0) In March,
  18. Max (decode (B. Mon,'February', B. YJ,0) In March,
  19. Max (decode (B. Mon,'February', B. YJ,0(March)
  20. From Table2 a left join Table1 B on A. Dep = B. Dep
  21. Group by dname

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.