var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: help with tricky query in MSSQL
Let's say that I have three tables:
Now, I've been racking my brain on how to list the Buyers and the number of related rows in the Orders table. Add to this that I only want to count the Orders where DatePaid IS NOT NULL.
Any help would be enourmously appriceated.
select Buyers.ID, Buyers.Name, count(Orders.ID)
left outer join Session on Buyers.ID = Session.Buyer
left outer join Order on Session.ID = Order.Session and Orders.DatePaid is not null
Thank you so much!
jeepers, mattias, did you notice how similar this solution is to the one i gave you?
so, inquiring minds wanna know, which one did you use? inner or left outer joins?