I have three tables, many to many relationship
the tables will be like the following if I insert data
I want to get the product name where (propertyValue='ios' or propertyValue = 'android') and (propertyValue='black')
In another way, we can say
I want to get the product name where (propertyid='2' or propertyid = '4') and (propertyid='3')
I tried second way and there is a SQL:
Select DISTINCT(p.productname),p.productid
from Products p
left join Product_propertyvalue ppv on p.productid=ppv.productid
where ( ppv.propertyvalueid=2 or ppv.propertyvalueid=4) and ( ppv.propertyvalueid=3 )