I'm stuck with a SELECT query. Can solve it with PHP but feels like it could be solved within my sql query:
I have a table with:
fightId, fighterId
I want to select only the fighterId's that have fightId 1 for example and then group them by fighterId and count them separately.
So you get 10 votes for fighterId 10 and 5 votes for fighterId 12 for example. Instead of just counting all ids from fightId x.
Code: Select all
$b_query = "SELECT fighterId FROM ufc_bet
WHERE fightId = ".$row['fightId'];
I am not expecting anyone to write the code for me, but don't know where to start.
With the above query I sort the fighterId's with some tacky php code and it hurts my eyes...