I made a query that should output the stud_fname, stud_sname, result_studpoints, result_position and studevent_result for a specific requirements where stud_gender = ‘M’, stud_yrGroup = ‘9’ and event_id = ‘1’.
This is the query:
SELECT stud_fname, stud_sname, result_studpoints, result_position, studevent_result FROM students
INNER JOIN result
WHERE stud_gender = 'M'
AND stud_yrgroup = '9'
AND result.stud_id IN (SELECT students.stud_id FROM result WHERE event_id = '1');
but it does not display the correct output.
The row Sam Cro should not be output because he does not do event_id = '1'. How can I fix my query so it outputs the correct data based on the requirements stated.
Thanks in advance.