SELECT status, count(status) FROM <table> GROUP BY status;
Mike Hillyer
www.vbmysql.com
-----Original Message-----
From: Eric Anderson [mailto:keric@stripped]
Sent: Tuesday, May 13, 2003 4:36 PM
To: mysql@stripped
Subject: count()
I'm not sure if I'm just having problems thinking today but if you've
got a field:
status enum('pending','active','cancelled') NOT NULL default 'pending'
and you want to get a total of each the entries, is there any way to do
it in one pass, as opposed to:
select count(*) from <table> where status='pending'
select count(*) from <table> where status='active'
...
mysql,sql
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=1