我要查询数据库中的数据,有下表
COLUMNS: Type, Location, name, etc.
DATA:
1. Stores in NJ, name = xyz
2. Restaurants in NY
3. Hotels in US
4. Stores in PA
5. Restaurants in VA
6. Hotels in MD
7. Stores in NJ, name = abc
8. etc.
我需要一个查询,从 1、2、3 中获取数据
现在,我有以下查询。这运行得更快。但是没有UNION我可以使用任何其他查询吗
select type, location from table1
where type='stores' and location='NJ' and name='XYZ'
UNION
select type, location from table1
where type='restaurants' and location='NY'
UNION
select type, location from table1
where type='hotels' and location='US'