Re: Count and group ?

From: Date: Thu, 02 May 2002 13:44:21 +0000
Subject: Re: Count and group ?
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-18927@lists.php.net to get a copy of this message
Hi Dave Assuming you are using mysql try the following query select count(Admin_id) as admin1, Admin_id as admin2 from TABLE_NAME group by admin2 substituting TABLE_NAME for whatever you have called your table. Hope this helps Cheers Tony James ----- Original Message ----- From: "Dave Carrera" <dave@davecarrera.com> To: <php-db@lists.php.net> Sent: Wednesday, May 01, 2002 1:02 PM Subject: [PHP-DB] Count and group ? Hi All I have added a row to my table which inputs which admin user has amended a record in a table on my db. I have this working but what I would like to do is count how many instances of the admin id I have stored. So if my list looks like this.. Admin_id 1 2 2 2 3 3 3 3 3 2 1 1 Then the result I would like to display is this.. Admin (1) = 3 posts Admin (2) = 4 posts Admin (3) = 5 posts Basically displaying the total post each admin has made Any help or guidance is very appreciated and thank you in advance Dave Carrera Php Developer http://davecarrera.freelancers.net http://www.davecarrera.com

« previous php.db (#18927) next »