I have a task that needs to be solved using an SQL query in MS Acess: "In which dormitory students from not all groups live".
My table is called Dormitories
and it has columns Student_name
, Student_group
, Dormitory_name
.
I am trying to solve it like this:
SELECT Dormitory_name
FROM Dormitories
GROUP BY Dormitory_name
HAVING COUNT(DISTINCT Student_group) < (SELECT COUNT(DISTINCT Student_group) FROM Dormitories)
But I constantly get out "Syntax error (lack of operator)" in the last line. Explain what's wrong