I think you need Casein Order byplace of conditions OR.
Try something like this
SELECT student.firstname,
candidates.partylist,
candidates.position
FROM student
INNER JOIN candidates
ON student.student_id = candidates.student_id
ORDER BY partylist,
CASE position
WHEN 'President' THEN 1
WHEN 'VicePresident' THEN 2
WHEN 'Secretary' THEN 3
WHEN 'Treasurer' THEN 4
WHEN 'Auditor' THEN 5
ELSE 6
END
Note. If you want data other than the list of references in Order bycome first, replace 6with 0.
source
share