So i'm looking for a way to have a query with a subquery, but the subquery returns more than one item.
ex.
SELECT * FROM menu where parent_id = (SELECT menu_id FROM menu WHERE parent_id = 0)
the subquery will return [22,30,33]
I would like the top query to execute logically as follows:
SELECT * FROM menu where parent_id = 22 OR parent_id = 30 OR parent_id = 33
I can't predict the count of the subquery.
I can do this with loops in my php but I have a feeling that it is possible to do this with a single SQL statement (multi subqueries).
Does anyone have any ideas???
Sera
ex.
SELECT * FROM menu where parent_id = (SELECT menu_id FROM menu WHERE parent_id = 0)
the subquery will return [22,30,33]
I would like the top query to execute logically as follows:
SELECT * FROM menu where parent_id = 22 OR parent_id = 30 OR parent_id = 33
I can't predict the count of the subquery.
I can do this with loops in my php but I have a feeling that it is possible to do this with a single SQL statement (multi subqueries).
Does anyone have any ideas???
Sera