The select Amy polumbo luid, a.c kcode,
The sum ((A.K cCount - (case when B.X sCount is null then 0 else B.X sCount end))) as kc
The from tStkLsKc A, tSalWtzPluDetail b
Where Amy polumbo luid=p. luid and Amy polumbo luid='10000000772' and b.D ataType in (' 0 ', 'A', 'B', 'C', '7')
Group by Amy polumbo luid, a.c kcode
CodePudding user response:
The building Lord give some sample data, and your desired results,CodePudding user response:
select Amy polumbo luid, a.c kcode,using the NVL function, than you had the better readability, as to what you said is empty, that is data problems, did not meet the conditions of the data
The sum (A.K cCount - NVL (B.X sCount, 0)) as kc
The from tStkLsKc A, tSalWtzPluDetail b
Where Amy polumbo luid=p. luid and Amy polumbo luid='10000000772' and b.D ataType in (' 0 ', 'A', 'B', 'C', '7')
Group by Amy polumbo luid, a.c kcode
CodePudding user response:
The original poster to express the meaning of the vagueIs A table to match the data in the table B B table does not correspond to record XsCount as 0, or recorded in the corresponding table B XsCount value is NULL, XsCount as 0
The former needs associated with the latter NVL can
CodePudding user response:
The