on 7/23/01 6:53 PM, Mike Gifford at [EMAIL PROTECTED] wrote:

> I'd like a simple query to determine how MANY books in a database are released
> by A publisher.  This shouldn't be a big deal, but I've looked at a number of
> solutions and am coming up short.  MySQL is being accessed via phplib, but I'm
> sure that it's just how I'm expressing the general MySQL query.

Maybe I'm not quite getting it, but how about:

SELECT COUNT(bibID) FROM bookDB WHERE publisherID='$your_publisher_id';

> The bookID & publisherID are both listed in the bookDB.  I just want a query
> which will go through the database and return the publisherID and a count of
> the number of books.

You can do a group by to get them all at once:

SELECT COUNT(*) AS book_count, publisherID FROM bookDB GROUP BY publisherID;

Then use your favorite mysql_fetch_*** and access them.

Hope that helps.


Paul Burney

Paul Burney
Webmaster && Open Source Developer
(310) 825-8365

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to