i have 2 tables.
table one: items
table two: items_options
now i need a search for 2 options_ids on table two
SELECT i.id FROM items as i
INNER JOIN items_options as io ON i.item_id = i.id
WHERE io.option_id = 60143 AND io.option_id = 60142
ORDER BY i.xy ASC LIMIT 0,50
How can i do it without group by/having?
It seems like you want
ORor use anINstatement.OR
You cannot have an
option_idthat has both values.EDIT: If you want both values you can use a
UNION ALLquery:Or you could try joining on the
items_optionstable twice: