I am filtering a table that has records about Exams. A user can take an exam only 5 times during one year.
How to filter this?
I managed to filter the part with 5 times, but how can I check for date difference if the user has already been to exams for five times.
This is my query so far:
SELECT ClassId,StudentId
FROM Exam
GROUP BY ClassId,StudentId
HAVING Count(Date) <5
I thought I could just use OR DateDIff after the Having, but it must be in the WHERE clause.