I have table contains img_id and likes columns.
Example:
1 1
1 1
1 0
2 0
2 0
3 1
so when run this queries:
select img_id, count(likes)
from my_table
where likes = 1
group by img_id
here’s the result:
1 2
3 1
and whe I run:
select img_id, count(likes)
from my_table
where likes = 0
group by img_id
the result is:
1 1
2 2
my question is:
how can i return in query1 img_id 2 = 0 , I mean img_id = 2 has no likes
also in query 2 img_id = 3 has no dislikes so i need to return 3 -> 0
In MySQL and SQL Server,
or simply in MySQL,