A user can choose a list of option combinations and then search for them.
The sql could look like this.
select * from p where (option_type = 'X' and value = 'A')
or (option_type = 'X' and value = 'B')
or (option_type = 'Y' and value = 'D')
But of course I do not want to have n number of or's
How would a good sql look like that performs ??? The user can choose many option combinations.
Thanks.
No need for multiple ORs:
select *
from p
where (option_type, value) in ( ('X' ,'A'), ('X','B'), ('Y','D') )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With