MS SQL showing records where sum() is null
Posted on 2014-02-06
I have two tables, Location and Sales. There are multiple sales for each location for each day. I need to get the location to display even if there were no sales for that day, For example, with the winter weather some locations were closed do to the weather and they had no sales but I still want them to show up in the list. Here is the script I am using and the data below the script is the results I am looking for.
from Location l
Left Outer Join Sales s on s.LocationId = l.LocationId
where s.TransDate = '2014-02-05'
group by l.StoreId, s.TransDate
order by l.StoreId
3 0 (they were closed)
Thanks for the help.