如何列出不是 (null = 0) 的产品?
斯塔尔表
id STHAR_GCKOD STHAR_GCMIK
------------------------------------------------
1 NULL NULL
99 G 2
99 C 2
1525 G 3
1525 C 2
------------------------------------------------
NOTE: G = (+) / C = (-)
结果
ID 1; Not found in result, i want to found in result (TOTAL : 0)
ID 99; TOTAL : 0
ID 1525; TOTAL : 1
我的代码:
SELECT
B.STOK_KODU, B.STOK_ADI, B.URETICI_KODU, B.KOD_1,
SUM(CASE A.STHAR_GCKOD
WHEN 'G' THEN STHAR_GCMIK
ELSE - STHAR_GCMIK
END) BAKIYE
FROM
LSTHAR A
RIGHT OUTER JOIN
TBLSTSABIT B ON B.STOK_KODU=A.STOK_KODU
GROUP BY
B.STOK_KODU, B.STOK_ADI, B.URETICI_KODU, B.KOD_1
HAVING
SUM(CASE A.STHAR_GCKOD WHEN 'G' THEN STHAR_GCMIK
ELSE - STHAR_GCMIK END) < B.KOD_6
ORDER BY
B.STOK_KODU ASC
找不到结果列表为空或空数据,
让我想要的结果列表
可能的 ?
谢谢 ..