Need help with MySql Query
Posted on 2017-06-17
I need little help with the query.
i.e I've following table with products data:
id, store_id, title, price, is_store_own_product
Followng is the scenerio:
Stores can have their own products as well as other products. With each product we have boolean field "is_store_own_product" which shows its store own product also there can be 1 store selected all the time:
Now, I need to show all products for selected store i.e where (store_id = current_store_id AND is_store_own_product=0 or is_store_own_product=1) but also want to show other store products that are not their own i.e where (store_id <> current_store_id AND is_store_own_product=0).
I tried with "NOT IN" but its taking lot of time.
I hope this make sense.
Thanks a lot.