468,315 Members | 1,400 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,315 developers. It's quick & easy.

Mysql select question, counting total recs for each state?

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

etc.

sorted by state of course.

How do I do this.

thanks for any help
Jul 16 '05 #1
1 2275
In article <dt********************************@4ax.com>,
MeNotHome <dtfa@****nospm****insightbb.com> wrote:
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

etc.

sorted by state of course.


Search the mysql.com "GROUP BY", "COUNT()", and "ORDER BY" documentation.
An example:

select state, count(event) from events_table group by state order by state

--
CC
Jul 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

19 posts views Thread by Westcoast Sheri | last post: by
reply views Thread by Phil Powell | last post: by
reply views Thread by Philip Stoev | last post: by
reply views Thread by Mike Chirico | last post: by
4 posts views Thread by Qun Cao | last post: by
3 posts views Thread by Megan | last post: by
39 posts views Thread by windandwaves | last post: by
27 posts views Thread by Simon Biber | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by Teichintx | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.