Re: count from the results
| From: | Jason Wong | Date: | Sat, 09 Feb 2002 18:04:29 +0000 |
| Subject: | Re: count from the results | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-16759@lists.php.net to get a copy of this message | ||
On Sunday 10 February 2002 00:55, Barry Rumsey wrote:
> I have the following code:
> $query = "SELECT * FROM artist WHERE artist LIKE 'b%' ORDER BY artist
> ASC";
[snip]
> What I would like to know is how do I do a count on each result
> returned.e.g. Benny(4) , Bill(10)
Try:
$query = "SELECT artist, count(artist) FROM artist WHERE artist LIKE 'b%'
ORDER BY artist ASC";
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
/*
Love is being stupid together.
-- Paul Valery
*/