記12-7版本業務邏輯 - A不包含B且不包含C且不包含D

隨緣清風殤發表於2020-12-07
SELECT SUM(CASE WHEN b.flag IS NULL THEN c.value ELSE NULL END) AS sum_value  FROM hive.`CCC` AS c
LEFT JOIN (
SELECT * FROM (
SELECT * FROM hive.`AAA`
UNION ALL
SELECT * FROM hive.`BBB`
) AS a
GROUP BY a.flag) AS b
ON c.flag = b.flag

相關文章