私のテーブル-
pid id subject section
1 1 7 0
2 1 12 0
3 1 13 1
4 1 13 2
5 1 13 3
6 1 14 3
7 1 14 4
8 2 15 1
9 2 16 1
得られる結果-
id subject total
1 7 1
1 12 1
1 13 3
1 14 2
私の質問-
SELECT DISTINCT(SUBJECT), count(section)
FROM mytable
GROUP BY section
WHERE id = 1
しかし、これはエラーをスローしています、私が間違っていることを教えてください
エラー
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE id = 1' at line 4: SELECT DISTINCT(SUBJECT), count(section) FROM mytable GROUP BY section WHERE id = 1