I've got a query that looks like this:
SELECT t1.id, t1.name, t1.description
FROM t1
LEFT JOIN t2 ON (t2.id = t1.id)
WHERE condition
GROUP BY t1.id
LIMIT 100
I would like to count the total number of rows that satisfy this query past the limit in addition to returning the specified columns (id, name, description). The problem is that due to the GROUP BY, if I were to do a count(*), I just get a bunch of rows with 1.
So my question is: how can I count the number of rows returned by this query? And how can I do so disregarding the limit?
Also is it possible to return both the row count AND the column data in a single query? Or would I need to use two queries?