I'm running MySQL 4.0 and it doesn't support sub-queries... I've checked and found that the next query returns rows of counting each union part seperatedly and could make sum on its rows: (SELECT COUNT(*) FROM table WHERE id>100) UNION ALL (SELECT COUNT(*) FROM table2 WHERE id>150) returns: +------------+ | COUNT(num) | +------------+ | 124 | | 912 | +------------+
When running the query without union, you could use SQL_CALC_FOUND_ROWS even when having LIMIT, but this option not works when using union.. :( Is there anything like SQL_CALC_FOUND_ROWS in union? since I don't want to run the query twice Also... if I run the same query twice.. first run and selecting columns.. then I run the same query but selecting COUNT(*).. does the second time will run using MySQL's cache? ""Lorderon"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > How can I find the number of rows a query returns when I'm using UNION ? > > for example, how can I know how much rows the next query returns: > (SELECT price FROM table1 WHERE id>100) > UNION > (SELECT price FROM table2 WHERE id>150) > > > thanks in advance, > -Lorderon. > > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]