I am trying to run a query that returns a list of IDs that appear more than 3 times in a table called Hospital. So far I have come up with this:
SELECT doctorID
FROM Hospital
WHERE doctorID IN
(SELECT temp.doctorID, count(temp.doctorID) as frequency
FROM Hospital as temp
GROUP BY temp.doctorID
HAVING frequency >3);
but for some reason i get an error when i run it
Code: 1241. Operand should contain 1 column(s)
Seemed to be a popular error when I looked around, but I can't find an existing solution that applies to me. When I run the query that in parenthesis by itself, it works fine. So how come it doesn't work as a subquery?