COUNT(*) from multiple tables

wxdqz

New Member
How can I count the number of rows in 2 tables in 1 command? I can just do a simple:

select count(*) from table1;
select count(*) from table2;

But I want to execute this on 1 command. The tables are the exact same description with id auto_increments. I tried:

select count(t1.id),count(t2.id)
from table1 t1, table2 t2;

But it returned some number that was several times larger than the actual value.

Suggestions? I wish there was just a select rows(table1) or something.

Thanks,

Mike
 
Back
Top