I have a below query:
select count(*) c , id
from hr
where time >= '2011-11-8 00:00:00' and
time <= '2011-12-9 23:59:59'
group by id
having c>3;
The result list could be very huge (up to 10,000 items sometime), I don’t want to list all since I only want to get the total number. Apart from “select found_rows()”, I’m trying to find one sql sentence to get the job done without printing the list. (I’m not using Perl, PHP or any other API, just sql)
Any idea?
Thanks in advance.
Yang
Wrap it in a subquery and count the records again