multiple counts

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

multiple counts

Post by Illusionist »

this would be right, right?

Code: Select all

$sql = "SELECT COUNT(t1.*) as t1Count, COUNT(t2.*) as t2Count FROM table1 t1, table2 t2";
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

why not try it?
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

uhm... I was asking if it would work? Can you do multiple counts like that? I haven't seen it done anywhere so i was curious. And i'm not at a computer or place that i can try it...
User avatar
smpdawg
Forum Contributor
Posts: 292
Joined: Thu Jan 27, 2005 3:10 pm
Location: Houston, TX
Contact:

Post by smpdawg »

No.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

for Illusionist:

meaby you should read (and try to understand) a decent introduction to sql first... and then you can start wondering how much sense it makes....

hint: count is a set-function.
Post Reply