mySQL: Can I make count() honor limit clause?

Posted by Stomped on Stack Overflow See other posts from Stack Overflow or by Stomped
Published on 2010-05-17T22:12:15Z Indexed on 2010/05/17 22:20 UTC
Read the original article Hit count: 164

Filed under:

I'm trying to get a count of records matching certain criteria within a subset of the total records. I tried (and assumed this would work)

SELECT count(*) 
FROM   records 
WHERE  status = 'ADP'
LIMIT  0,10

and I assumed this would tell me how many records of status ADP were in that set of 10 records. It doesn't - it returns, in this case 30, which is the total number of ADP records in the table.

How do I just count up the records matching my criteria including the limit?

© Stack Overflow or respective owner

Related posts about mysql