Hey guys.
I’ve been looking into subqueries and I found two recursive subquery clauses that I’m unfamiliar with.
Does anyone know how ANY () and ALL () work?
I tried something like this:
SELECT s.name FROM students s WHERE id = ANY (SELECT f.owner_id FROM friends f WHERE f.user_id = 11)
This seemed to return all the values (kinda like a join statement).
Where…
SELECT s.name FROM students s WHERE id = ALL (SELECT f.owner_id FROM friends f WHERE f.user_id = 11)
This seemed to return nothing.
I believe that ANY works like a recursive loop for all the subquery results (if its more than one value), but I have no idea how ALL works.
Any ideas?