I'm trying to get the results of a table where ALL the items match AND then only show the results where they all match within a specific stockId.
I've tried to do variantId IN (4,1,8) as an example, but it shows me all the results not where they ALL match 4 1 AND 8:
SELECT * FROM `products_bind_variant_stock_combination`
WHERE `variantId` IN (4,1,8)
I'm expecting it to return either 3 results of where the variant Id match 4, 1 AND 8. Or I want to show just the stock ID where the IDs match all of those.
My structure in
products_bind_variant_stock_combination
|subId |int(10)|No |
|productsId |int(10)|Yes|NULL
|stockId |int(10)|Yes|NULL
|variantId |int(10)|No |
A small sample is:
|1|69|1|4
|2|69|1|1
|3|69|1|8
|4|69|2|5
|5|69|2|1
|6|69|2|8
|7|69|3|6
|8|69|3|1
|9|69|3|8
The result I want when searching variantId as matching 4,1,8 is:
|1|69|1|4
|2|69|1|1
|3|69|1|8