RE: count(*) on different tables

2001-05-22 Thread Crercio Osmaildo da Silva
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

Re: count(*) on different tables

2001-05-22 Thread btjones
UNION is currently not supported, though one workaround is merge tables, it's not quite the same thing. As to your query SELECT COUNT(*) FROM table1,table2, it is returning the expected result. Without a WHERE clause, you are getting the cartesian product of both tables (all rows from table1 jo

Re: count(*) on different tables

2001-05-22 Thread Ansgar Becker
> > 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 > Select 'Table1' as tableName, count(*) as rowCount from tabl

Re: count(*) on different tables

2001-05-21 Thread ryc
As far as I know, they should be the same. The only case in which I can see count(colname) would be slower is if it doesnt count rows that contain null values for that column (this is only a guess, I dont know if count does that or not). ryan > Would count(*) show the same performance as count(1

Re: count(*) on different tables

2001-05-21 Thread Siomara Pantarotto
That's really cool Thanks siomara >From: "Eric Fitzgerald" <[EMAIL PROTECTED]> >To: "Siomara Pantarotto" <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> >Subject: Re: count(*) on different tables >Date: Mon, 21 May 2001 14:08:00 -0700 >

Re: count(*) on different tables

2001-05-21 Thread Eric Fitzgerald
ot;Siomara Pantarotto" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, May 21, 2001 1:48 PM Subject: Re: count(*) on different tables > Cool but how about if you put a where clause to your select?? > > SQL> select count(1

Re: count(*) on different tables

2001-05-21 Thread Siomara Pantarotto
>To: "Siomara Pantarotto" <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> >Subject: Re: count(*) on different tables >Date: Mon, 21 May 2001 13:11:38 -0700 > >Actually, as far as performance goes, it depends on table types. Most of >the MySQL table handlers keep an

Re: count(*) on different tables

2001-05-21 Thread Eric Fitzgerald
> To: <[EMAIL PROTECTED]> Sent: Monday, May 21, 2001 12:26 PM Subject: Re: count(*) on different tables > Well ... > > I don't know enough about mysql but it must allow you somehow to specify the > column by number as in Oracle and other DBs > > S

Re: count(*) on different tables

2001-05-21 Thread Siomara Pantarotto
Well ... I don't know enough about mysql but it must allow you somehow to specify the column by number as in Oracle and other DBs SQL> select count(*) from product; COUNT(*) -- 10 SQL> select count(1) from product; COUNT(1) -- 10 Once you just want to cou

Re: count(*) on different tables

2001-05-21 Thread Cal Evans
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 UNI