You are here: SQL WHERE CLAUSE HELP « MsSQL Server « IT news, forums, messages
SQL WHERE CLAUSE HELP

Posted by RickyZane on 10/11/06 03:28

I need a little help with an assignment....


Basically I have a table with several PRODUCTS
PRODUCT(P_ID, P_Name, P_Class, P_Price, Product_Supplier)

Anyways....

I need to display:

List each Product Class, number of items in the class and the average
Price of the items in the class. List only those classes that have more
than three (3) items.

I have this

Select P_Class, COUNT(P_Class), AVG(P_Price)
>From PRODUCT
Group by P_Class;

Here are the results

P_CLASS COUNT(P_CLASS) AVG(P_Price)
------------ -------------- ------------


Camera 2 362.975
Printer 4 255.2375
DVD 2 83.75
Processor 3 139.95
Storage 8 391.855
Software 2 322.5
OS 2 292.495
Monitor 3 184.65

But I'm not for sure how to get the WHERE in there correctly to just
show me the items with the 3 or more COUNT (items) in them. Any help
would be great.

Thanks

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация