Here is my problem. I have a database which stored user votes.
The vote table looks like this:
Table vote
id PK
winner
loser
judge
......
I would like to have this kind of stats:
User had X victories and Y defeats when a certain user was the judge.
It's quite easy to find out the total of victories or defeats from a single judge, but I can't find out how to get the two aggregate results from 1 query. Is it possible?
My sql statement for finding how many victories a user had when a certain judge was involved:
select vote.winner, count(*) from vote where vote.judge = '1' GROUP BY vote.winner;
So, I get Winner name and count of victories. Now, I can I get number of defeats in the same query? Is is possible?
Your help would be really appreciated!