I'm looking to optimise an SQL query with two IN
conditions in the WHERE
clause and preserve the original behavior. For example:
New query:
select * from empl
where age in (50,65) and location in ('Panama','Nigeria');
Original query:
Select * from empl
where (age = 50 and location = 'Panama') or (age = 65 and location = 'Nigeria');
Problem: The original query returns 2 rows, but the new query clubs all the ages and location in the IN
condition and returns multiple rows.
How to optimize this properly?