=
kan bruges, når underforespørgslen kun returnerer 1 værdi.
Når underforespørgsel returnerer mere end 1 værdi, skal du bruge IN
:
select *
from table
where id IN (multiple row query);
For eksempel:
SELECT *
FROM Students
WHERE Marks = (SELECT MAX(Marks) FROM Students) --Subquery returns only 1 value
SELECT *
FROM Students
WHERE Marks IN
(SELECT Marks
FROM Students
ORDER BY Marks DESC
LIMIT 10) --Subquery returns 10 values