I have five columns in a table called tbl_enrolments(id, student_id, semester_id, unit_id, date). Here I just need to count the number of same unit_id according to same semester_id from this table. This is how I've tried so far..
SELECT e.unit_id, COUNT(e.unit_id) as count,
u.unit_title,
u.unit_name,
s.sem_name
FROM tbl_enrolments e
INNER JOIN tbl_unit_of_study u
ON e.unit_id = u.id
INNER JOIN tbl_semesters s
ON e.semester_id = s.id
GROUP BY e.unit_id
Here this query is counting all same unit_id from all different semester_id. But I need to count all same unit_id with only same semester_id. How can I do that?
My table is like this:

semester_id. There are multiplesemester_idand I have to count allunit_idaccording to all samesemester_id.