I have a query which returns the total number of votes (COUNT()) and the sum (SUM()) of all votes. A single vote is stored as a -1 or a 1.
Now I get the following and want to know what the number of positive votes is:
- SUM: -2
- Total votes: 4
What is the formula to get the number of positive (and negative) votes?
In the example the outcome is: -1 + -1 + -1 + 1 (3 negative votes and 1 positive)
where
yis the number of positive votes andxthe negatives.