List:General Discussion« Previous MessageNext Message »
From:Mike Hillyer Date:May 13 2003 10:33pm
Subject:RE: count()
View as plain text  
SELECT status, count(status) FROM <table> GROUP BY status;

Mike Hillyer

-----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 General Mailing List
For list archives:
To unsubscribe:

count()Eric Anderson14 May
  • Re: count()Jeff Shapiro14 May
  • Re: count()Dan Nelson14 May
  • Re: count()Paul DuBois14 May
  • RE: count()Jennifer Goodie14 May
  • Re: count()Keith C. Ivey14 May
  • Re: count()(Pete Harlan)14 May
  • Re: count()Matt Silva15 May
Re: count()Steve Edberg14 May
  • Re: count()CR14 May
Re: count()Steve Edberg14 May
RE: count()Eric Anderson14 May
RE: count()Mike Hillyer14 May