On Thu, 1999-09-09 14:13:06 +0200, Patric de Waha wrote:
> Ok but now I need to know what was the row count if wouldn't limit
> the result [...]
> If possible I don't want to requery because the query can be very
> complicated and slow.
Two possibilities come to mind:
a) SELECT COUNT(*) FROM ...
This gives you the number of result rows and often is
faster than the actual select.
b) Using an appropriate temporary table:
1st, INSERT INTO tmp SELECT ...
All result rows are now stored in tmp and the number of
rows can be obtained by the function mysql_num_rows()
(exact syntax depends on your programing interface).
2nd, SELECT * FROM tmp LIMIT ...
Just get the readily prepared result rows.
Martin Ramsch <m.ramsch@stripped> <URL: http://home.pages.de/~ramsch/ >
PGP KeyID=0xE8EF4F75 FiPr=52 44 5E F3 B0 B1 38 26 E4 EC 80 58 7B 31 3A D7