If you are using PHP (or anothe controlling language, you could take the
results of  SHOW TABLES and loop through it either doing a single select for
each table or building a select statement that UNIONs the results together.
i.e.

Select 'Table1' as tableName, count(*) as rowCount from table1
UNION
Select 'Table2' as tableName, count(*) as rowCount from table2
...
etc

Assuming that MySQL can use the UNION clause. (I haven't checked)

My DBA says that in MS T/SQL you can do this:

select  solcount = count( distinct s.solKey ), probcount = count( distinct
p.probKey )
from  sol s, prob p

where SOL and PROB are tables.

HTH,
Cal
http://www.calevans.com

----- Original Message -----
From: "Ansgar Becker" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, May 21, 2001 1:18 PM
Subject: count(*) on different tables


> Hi,
>
> is it possible to get *one* quick result with the rowcount of each table
in
> one database, without knowing the column-names?
>
> this does *not* work:
>  select count(t1.*), count(t2.*)
>    from table1 t1, table2 t2
>
> Manual doesn't say anything about that.
>
> Greetings,
> Ansgar Becker
>
>
>
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to