That is my mat_likes tables:
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
How can I select mat_id
of those materials, which have the most yes = 1
. Еxample of subtracting the results:
-
mat_id = 1
, because have totalyes = 3
-
mat_id = 4
, because have totalyes = 2
-
mat_id = 3
, because have totalyes = 1
-
mat_id = 2
, because have totalyes = 1