I have this query and I want to know if its possible to write it without a UNION clause.
select id from table_a
where
(name='Atlanta' And locations In ('1' ,'2','3') )
union
select id from table_a
where
(name='Los Angeles' And locations In ('11' ,'12','13')).
Basically I only want those ids who have records with name='Atlanta' and locations in 1,2,3 and name='Los Angeles' and locations in 11,12,13.
The above UNION query gives me the correct results but my requirement does not allow using a UNION clause. Thanks in advance.
select id from table_a
where
(name='Atlanta' And locations In ('1' ,'2','3') )
union
select id from table_a
where
(name='Los Angeles' And locations In ('11' ,'12','13')).
Basically I only want those ids who have records with name='Atlanta' and locations in 1,2,3 and name='Los Angeles' and locations in 11,12,13.
The above UNION query gives me the correct results but my requirement does not allow using a UNION clause. Thanks in advance.