這是我mat_likes表:MySQL的:選擇查詢
mat_id| yes| no
1 | 1 | 0
1 | 1 | 0
1 | 1 | 0
2 | 1 | 0
3 | 1 | 0
4 | 1 | 0
4 | 1 | 0
如何選擇這些材料,它們具有最yes = 1
的mat_id
。減去結果Еxample:
mat_id = 1
,因爲有總yes = 3
mat_id = 4
,因爲有總yes = 2
mat_id = 3
,因爲有總yes = 1
mat_id = 2
,因爲有總yes = 1