使用下面写的case语句,我得到y和z的相同值

时间:2018-05-02 06:08:55

标签: nested case

---获取cc,x,y。 Case语句返回x和y的相同值。你可以建议重新调整正确的值

SELECT
    cc.x,
    sfc.y,
    sfc.z
FROM
    t1 cc,
    t2 ccd - - - CASE statment,
    (
    SELECT
        td.td_id,
        - - -
    VALUE
FROM COLUMN TO
    be returned CASE WHEN td.tab_id = 30477 THEN td.td_code ELSE td.td_code
END AS Y,
CASE WHEN td.tab_id = 30478 THEN td.td_code ELSE td.td_code
END AS z
FROM
    t3 td,
    t4 td_nls - - -
WHERE
    clause
WHERE
    td_nls.td_id = td.td_id AND td.tab_id = 30478
) SFC
WHERE
    cc.commodity_id = ccd.commodity_id
    AND sfc.td_id = ccd.td_id
    AND cc.control_status = 1
    AND cc.group_id = 5767

0 个答案:

没有答案