Re: Re: Passing a PHP variable to javascript
| From: | Adam Williams | Date: | Mon, 19 Aug 2002 17:01:10 +0000 |
| Subject: | Re: Re: Passing a PHP variable to javascript | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-113234@lists.php.net to get a copy of this message | ||
Look up on www.mysql.com documentation, you can do a count within a select
statement
SELECT whatever COUNT(whatever) AS COUNT FROM table GROUP BY 'something'
HAVING something = 'something'
--------------------------
| whatever | count |
--------------------------
| stuff selected | 50 |
--------------------------
Adam
On Mon, 19 Aug 2002, Pag wrote:
>
> Hi, i am coding a news manager backend for a client and i ran into a
> little problem.
>
> I have two tables, one with the news and one with the comments on each news.
>
> How can i count how many comments there are for each news entry? Simply
> put, is there some sort of Mysql command query that can count how many
> records exist with a given field content?
> Example:
>
> Count on a database how many "peter"s there are in there?
>
> Is there a specific SQL select or something, or i have to make a loop just
> to count them?
>
> Thanks.
>
> /Pag
>
>
>
>