The COUNT()
is working as expected. When you put a group by
clause, the count()
gives you the result for GROUP BY
. If you wish to get the count of rows in a query that includes group by
, use it as a subquery instead.
Something like:
SELECT COUNT(*) FROM (SELECT * FROM `table`
GROUP BY `column1`) AS `a`
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…