Using Max and Decode functions to convert columns into line __ functions

Source: Internet
Author: User

Directly query the SQL statement, the "element_name" element into the row display.

SELECT v.element_name,v.result_value from Pay_run_results_v V WHERE v.assignment_action_id=64293

Conversion of SQL statements, skillfully using Max and decode

SELECT MAX (DECODE (element_name, ' cdgm_ performance pay ', Result_value, 0)) performance pay,

MAX (DECODE (element_name, ' taxation information ', Result_value, 0)) Taxationinformation,

MAX (DECODE (element_name, ' Taxation deduction ', Result_value, 0)) Taxationdeduction,

MAX (DECODE (element_name, ' Tax, Information ', Result_value, 0)) Taxreportinformation,

MAX (DECODE (element_name, ' cdgm_ should be total ', Result_value, 0)) should be issued in total,

MAX (DECODE (element_name, ' cdgm_ ", Result_value, 0)) is invalid,

MAX (DECODE (element_name, ' cdgm_ total ", Result_value, 0)) Total

From Pay_run_results_v

WHERE assignment_action_id=64293

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.