Reputation: 301
After some research I now understand I cannot return multiple columns from a subquery. What can I do instead?
SELECT * FROM `users` WHERE `id` IN (SELECT `id1`, `id2` FROM `ids` WHERE `location` = 1)
The result is #1241 - Operand should contain 1 column(s)
Upvotes: 0
Views: 421
Reputation: 2660
Try this:
Select users.*
from users
join ids
on users.id IN(ids.id1, ids.id2)
and ids.location = 1;
Upvotes: 1