SELECT COUNT(id) as reports FROM users WHERE id != 1 LIMIT 2500
still does not work, any idea?
Posted 29 December 2012 - 02:24 AM
SELECT COUNT(id) as reports FROM users WHERE id != 1 LIMIT 2500
Posted 29 December 2012 - 06:30 AM
Edited by Manixat, 29 December 2012 - 06:41 AM.
Posted 29 December 2012 - 06:34 AM
http://thorpesystems.com | http://proemframework.org | http://github.com/trq
SmtpCatcher - A very simple mock sendmail useful for testing PHP mail scripts.
Posted 29 December 2012 - 06:43 AM
COUNT() only returns one row, so that's why you can't LIMIT it. You could do a normal SELECT query and then use PHP to count the result set.
Posted 29 December 2012 - 09:32 AM
Edited by Christian F., 29 December 2012 - 09:32 AM.
Posted 29 December 2012 - 04:07 PM
Use a subquery, set the limit in that, and have the count be in the outer query.
http://thorpesystems.com | http://proemframework.org | http://github.com/trq
SmtpCatcher - A very simple mock sendmail useful for testing PHP mail scripts.
Posted 30 December 2012 - 03:54 AM
SELECT IF (COUNT(id) > 2500, 2500, COUNT(id)) AS total FROM tbl;
http://thorpesystems.com | http://proemframework.org | http://github.com/trq
SmtpCatcher - A very simple mock sendmail useful for testing PHP mail scripts.
0 members, 0 guests, 0 anonymous users