SELECT '0' flag,
aa,
SUM(nvl(a201, 0)) a201,
a191,
a192,
(CASE
WHEN aa151 = '1' THEN
(SELECT a03 FROM a WHERE a01 = b4.a200)
WHEN aa151 = '2' THEN
(SELECT a04 FROM b WHERE b01 = b4.a200)
ELSE
''
END) b004
FROM b4
WHERE a192 = '0'
GROUP BY '0', aa, a191, a192
SQL语句中CASE函数的用法
最新推荐文章于 2024-09-18 18:11:55 发布