Database Error: Couldn't query.
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'inout = inout
AND gender = gender
GROUP BY school
ORDER BY first_place DESC, ' at line 12
SELECT school,
COUNT(IF(place = 1,1,NULL)) AS first_place,
COUNT(IF(place = 2,1,NULL)) AS second_place,
COUNT(IF(place = 3,1,NULL)) AS third_place,
COUNT(IF(place = 4,1,NULL)) AS fourth_place,
COUNT(IF(place = 5,1,NULL)) AS fifth_place,
COUNT(IF(place = 6,1,NULL)) AS sixth_place,
COUNT(IF(place = 7,1,NULL)) AS seventh_place,
COUNT(IF(place = 8,1,NULL)) AS eighth_place
FROM `data`
WHERE event = event
AND inout = inout
AND gender = gender
GROUP BY school
ORDER BY first_place DESC, second_place DESC, third_place DESC, fourth_place DESC, fifth_place DESC, sixth_place DESC, seventh_place DESC, eighth_place DESC