=
dapat digunakan ketika subquery hanya mengembalikan 1 nilai.
Ketika subquery mengembalikan lebih dari 1 nilai, Anda harus menggunakan IN
:
select *
from table
where id IN (multiple row query);
Misalnya:
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