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

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -