SELECT cid,
SUM(vote) AS upvoted,
SUM(CASE
WHEN vote = 0
THEN 1
ELSE 0
END) AS downvoted
FROM yourtablename
GROUP BY cid;
0
solved counting upvotes and downvotes [closed]
SELECT cid,
SUM(vote) AS upvoted,
SUM(CASE
WHEN vote = 0
THEN 1
ELSE 0
END) AS downvoted
FROM yourtablename
GROUP BY cid;
0
solved counting upvotes and downvotes [closed]