counting total recs for each state?

Codes here !

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 19
Joined: Sun Apr 13, 2003 7:23 pm

Sat Jul 12, 2003 1:10 pm

I have a bunch of event records for various event dates.

I want to write an select state that shows the following

State Count
AZ 50
AR 2
AK 450
CO 75
CT 92


sorted by state of course.

How do I do this.

thanks for any help

User avatar
Posts: 2257
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back

Sat Jul 12, 2003 1:49 pm

Try this:

Code: Select all

SELECT State, COUNT(*) AS Count FROM tbl_name GROUP BY State ORDER BY State;

Answered pretty much the exact same question yesterday -- you might try a search of the board before posting next time.

Post Reply