Home » Developer & Programmer » Forms » How to Solve this COUNT problem
icon5.gif  How to Solve this COUNT problem [message #204284] Sun, 19 November 2006 23:44 Go to next message
qadeerahmed
Messages: 63
Registered: July 2006
Location: Pakistan
Member
Hi,

I've a query related to COUNT.
As we KNOW, we can calculate the total number of records in a table by this query
SELECT COUNT(*) FROM TABLE


I want to know about "How to calculte how many entries are there for each customer in a table".

ANd I want to display in combo box.

e.g
customer1 count is 4
customer2 count is 3
customer3 count is 2

thanks very much

Regards,
Qadeer Ahmed
Re: How to Solve this COUNT problem [message #204289 is a reply to message #204284] Sun, 19 November 2006 23:56 Go to previous message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
What's wrong with "select customer, count(*) from table group by customer order by count(*) desc"?

David

[Updated on: Mon, 20 November 2006 00:02]

Report message to a moderator

Previous Topic: Accessing a variable
Next Topic: enable buttons after the query
Goto Forum:
  


Current Time: Sat Dec 03 08:02:10 CST 2016

Total time taken to generate the page: 0.13286 seconds