I have the following select code:
But when I run it I am getting back NULLs when ever I have a NULL on returns field (the subtraction part of the query). I can break it into two fields and do the equation later if I have to but it is not desired.
Thanks for any help.
Code:
SELECT dbo.SOP30200.CUSTNMBR,
sum(CASE WHEN dbo.SOP30200.SOPNUMBE LIKE 'A-%' or dbo.SOP30200.SOPNUMBE LIKE 'I-%' THEN cast(dbo.IV00101.USCATVLS_1 as numeric(2)) END) - sum(CASE WHEN dbo.SOP30200.SOPNUMBE LIKE 'RET-%' THEN cast(dbo.IV00101.USCATVLS_1 as numeric(2)) END) AS PointTotal
FROM dbo.IV00101 INNER JOIN
dbo.SOP30300 ON dbo.IV00101.ITEMNMBR = dbo.SOP30300.ITEMNMBR INNER JOIN
dbo.SOP30200 ON dbo.SOP30300.SOPNUMBE = dbo.SOP30200.SOPNUMBE
WHERE (dbo.IV00101.USCATVLS_1 > '0')
GROUP BY dbo.SOP30200.CUSTNMBR
order by custnmbr
But when I run it I am getting back NULLs when ever I have a NULL on returns field (the subtraction part of the query). I can break it into two fields and do the equation later if I have to but it is not desired.
Thanks for any help.