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.
Sincerely,
Paul Burney
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Paul Burney
Webmaster && Open Source Developer
UCLA -> GSE&IS -> ETU
(310) 825-8365
<[EMAIL PROTECTED]>
<http://www.gseis.ucla.edu/>
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
--
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]