Using group by on two fields and count in SQL January 1, 2023 by Tarik I think you’re looking for: SELECT a, b, COUNT(a) FROM tbl GROUP BY a, b