Ashfaque Baig Ashfaque Baig - 2 months ago 8
C# Question

SQL table LEFT OUTER join query

enter image description here

What's the solution for attached image? How to remove null?

ClosingQty
column should reflect the value purchase-sale, but its reflecting null value

Answer

Your solution is failing as S.QUANTITY is NULL, so any arithmetic on it will result in a NULL answer. You will need to check for null, and replace with a valid number, for example 0.

The following should work:

ISNULL(P.QUANTITY,0) - ISNULL(S.QUANTITY, 0) AS ClosingQty

The real question, though, is why is S.QUANTITY null in the first place?

Comments