I have a table in which i want to get data on basis of attribute_id and attribute value pair.I want to pass array of both attribute_ids and its corresponding attribute_values and on basis of that i want to have a sku.There can be different values for same attribute id for same service_id but sku is different.Please suggest me some query.
Asked
Active
Viewed 52 times
1 Answers
0
You can select based on pairs:
SELECT `sku` FROM `mytable` WHERE (`attribute_id`, `attribute_value`) IN (
(3, 6000),
(8, 5000),
(9, 6)
);
Here's a question that offers more insight on that, as well as some more index-friendly alternatives: MySQL: How to bulk SELECT rows with multiple pairs in WHERE clause