I want show the result
SELECT GolDarah, count(GolDarah) JmlPasien
FROM tblPasien
WHERE monthname(TglLahir) IN ('July','August','September','October','November','December') AND count(GolDarah) JmlPasien = 2
GROUP BY GolDarah
ORDER BY GolDarah;
I Want show the result, but error.
ERROR 1111 (HY000): Invalid use of group function
>Solution :
You should to use HAVING statement like:
SELECT GolDarah, count(GolDarah) JmlPasien
FROM tblPasien
WHERE monthname(TglLahir) IN ('July','August','September','October','November','December')
GROUP BY GolDarah
HAVING count(GolDarah) = 2
ORDER BY GolDarah;
also WHERE statement can be more effective like:
WHERE month(TglLahir) > 5