mysql - SQL query like IN -
i have 1 table oc_product_option_value
data:
product_id | option_value_id | ------------------------------ 2262 | 78 | 2262 | 37 | 2263 | 70 | 2263 | 78 | 2264 | 37 | 2264 | 30 |
so, want product_id = 2262
, because has option_value_id = 78 , 37
. products don't match because have 1 of numbers.
use having
group by
.
query
select `product_id` `oc_product_option_value` `option_value_id` in (78,37) group `product_id` having count(*) = 2;
Comments
Post a Comment