1

データベース内のデータをクエリする必要があり、次のテーブルがあります

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'
4

2 に答える 2