I have a table of items.
And a second table of variations.
There can be multiple variations per item.
I’m attempting something like:
SELECT items.*, variations.id from items
JOIN variations
ON variations.item_id = items.id
WHERE variations.id IN (23,25,29)
GROUP BY items.id
Which would return any items that have ALL of the above variations, 23, 25 and 29.
I also need to return all the variations.id values of the returned item.ids.
I’ve tried a heap of different join solutions, but don’t think it’s the way to go. Is a subquery the answer? Any thought would be appreciated greatly.
1 Answer