You may want to look at this page:
What you are wanting to do is (at least as I see) is called a crosstab.
It takes a bit of trickery in MySQL, but it can be done.
On Tue, 13 May 2003 15:36:24 -0700 (PDT), Eric Anderson wrote:
> 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: http://lists.mysql.com/mysql
> To unsubscribe: http://lists.mysql.com/mysql?unsub=1