Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Inner join help

Author  Topic 

k80sg
Starting Member

7 Posts

Posted - 2011-07-18 : 16:10:10
Hi, I have the query below to help me find out which of my items are unsellable, how do I rephrase it such that it only shows 'Tight Pants' and 'Flowery stockings? Thanks!

select Products.ProductID, Products.ModelName, SUM(shoppingCart.Quantity)
from Products left join ShoppingCart
on (Products.ProductID = ShoppingCart.ProductID)

group by Products.ProductID, Products.ModelName
order by SUM(shoppingCart.Quantity) Desc

Result:
001 Lacy Dress 16
003 Skinny Jeans 22
005 Tight pants 0
007 Flowery stockings 0

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-07-18 : 16:18:53
HAVING COUNT(*) = 0

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -