I had the same problem to solv before, and this is what I did.
PS: I don't know if this is the right way to do it, but it worked for me.
mysql> CREATE TABLE Test.myTempTable (myTable VARCHAR(20), nrows AS
INTEGER);
mysql> INSERT INTO Test.myTempTable SELECT "Table1", COUNT(*) FROM Table1;
// 10 rows
mysql> INSERT INTO Test.myTempTable SELECT "Table2", COUNT(*) FROM Table2;
// 265 rows
mysql> SELECT * FROM Test.myTempTable;
+------------+------+
| myTable | nrows|
+------------+------+
| Table1 | 10 |
| Table2 | 265 |
+------------+------+
2 rows in set (0.00 sec)
mysql> DROP TABLE Test.myTempTable; // Finally drop the temp table
It is a little hard to code it in a application since you need to RUN 4
statements and treat each result in a separated row. But you can use this to
count any quantity of tables.
[]'s
Crercio O. Silva
---------------------------------------------------------------------
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