SQL Complex Select - Trouble forming query

Posted by JoshSpacher on Stack Overflow See other posts from Stack Overflow or by JoshSpacher
Published on 2010-04-29T05:09:48Z Indexed on 2010/04/29 5:17 UTC
Read the original article Hit count: 177

Filed under:
|
|

I have three tables, Customers, Sales and Products.

Sales links a CustomerID with a ProductID and has a SalesPrice.

select Products.Category, AVG(SalePrice) from Sales 
inner join Products on Products.ProductID = Sales.ProductID
group by Products.Category

This lets me see the average price for all sales by category. However, I only want to include customers that have more than 3 sales records or more in the DB.

I am not sure the best way, or any way, to go about this. Ideas?

© Stack Overflow or respective owner

Related posts about sql

Related posts about select