ASP MSSQL - SUM() total of 2 columns from 2 tables where date =
Posted on 2007-11-20
Hi, I am trying 2 sum the total value of 2 columns from seperate tables.
I can get the result if both tables have a value, but if my second table named savedorders has no value then i get no value at all returned.
I tried it with union as well, but could work out how to sum the 2 results at the end.
here is my code so far
SELECT (select SUM(grandtotal) AS Total FROM dbo.savedorders WHERE DATEDIFF (d, orderdate, getdate()) = 0 AND cardvaild ='y') + (SELECT SUM(grandtotal)
WHERE DATEDIFF (d, orderdate, getdate()) = 0 AND cardvaild ='y') as today