php-db | 2001072
Date: 07/24/01
- Next message: Chris Hobbs: "Re: [PHP-DB] search form"
- Previous message: Brian Weisenthal: "[PHP-DB] MS SQL datetime format problem"
- In reply to: Brian Dunworth: "RE: [PHP-DB] Counting Number of Instances in a One2Many Relationships"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
<snip>
> I'd like a simple query to determine how MANY books in a
> database are released by A publisher.
[...]
> The relevant table's here:
> Suggestions are appreciated!
SELECT publisherID,count(*) FROM WLPbib GROUP BY publisherID;
</snip>
That query is only acceptable if you want a list of all the publishers and
the books each of them produced. If you only want the results for one
publisher
SELECT count(*) FROM WLPbib WHERE publisherID = '$idtoquery'
should be more than acceptable
Either way you may want to consider indexing this table if you have a fairly
large number of records or will be doing a fair number of these queries on a
regular basis
Sincerely,
Craig Vincent
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe <email protected> For additional commands, e-mail: php-db-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Chris Hobbs: "Re: [PHP-DB] search form"
- Previous message: Brian Weisenthal: "[PHP-DB] MS SQL datetime format problem"
- In reply to: Brian Dunworth: "RE: [PHP-DB] Counting Number of Instances in a One2Many Relationships"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

