RE: Row counts in SQL 2000

RE: Row counts in SQL 2000

 

  

See Group By in BOL.

Select Customer, count(Customer) as CustomerCount
from Contact
group by Customer

Kevin Martin
Database Engineer
Multimedia Games, Inc.



-----Original Message-----
From: Agarwalla Avineet (Corporate) [mailto:mssqldba-ezmlmshield-x14449456.[Email address protected]
Sent: Monday, June 28, 2004 1:32 PM
To: LazyDBA Discussion
Subject: Row counts in SQL 2000

Hi All,

I need help in writing a SQL command to count the # of rows for each value in a table's column. I have 21 distinct values for a column Customer in the table Contact. How do I do this?


Thanks & Regards,

Avineet Agarwalla

This e-mail, together with any attachments, is confidential. It may be read, copied and used only by the intended recipient. If you have received it in error, please notify the sender immediately by e-mail or telephone. Please then delete it from your computer without making any copies or disclosing it to any other person. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.



---------------------------------------------------------------------
TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY Website : http://www.LazyDBA.com To unsubscribe: http://www.lazydba.com/unsubscribe.html
For additional commands, e-mail: mssqldba-[Email address protected]



---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.710 / Virus Database: 466 - Release Date: 6/23/2004


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.710 / Virus Database: 466 - Release Date: 6/23/2004


MS Sql Server LazyDBA home page