0

この 2 つのステートメントを 1 つのステートメントに混ぜてください。

  1. SELECT * FROM inventory WHEREプロステータス プロ='1' orステータス='2'

  2. SELECT * FROM inventory WHEREloca_city = 'tw' or loca_city= 'アメリカ'`

ステートメント 2 を実行するには、ステートメント 1 の結果が必要です。

//Property Status -0=suspended;1=valid(NORMALl);2=valid(GOOD);3=no/wrong number.
Data Base

ref pro_type    loca_city   pro_statusRemarks: 
00001   Industrial  HK      0
00002   Industrial  TW      2
00003   Commercial  HK      2
00004   Retail      TW      0
00005   Others      HK      2
00006   Retail      HK      2
00007   Others      HK      2
00008   Retail      USA     2
00009   Retail      HK      1
00010   Retail      HK      1
00011   Retail      TW      2
00012   Retail      HK      2
00013   Retail      HK      2
00014   Retail      HK      2
00015   Retail      HK      2
00016   Commercial  HK      1
00017   Retail      HK      1
00018   Others      HK      1

結果が必要です:

ref pro_type    loca_city   pro_statusRemarks: 
00002   Industrial  TW      2
00008   Retail      USA     2
00011   Retail      TW      2
4

3 に答える 3

0

両方のクエリが同じテーブルにあり、すべての条件がOR直接実行できる場合:

SELECT 
* 
FROM inventory 
WHERE `pro_status`='1' or `pro_status`='2' 
OR `loca_city` = 'hk' or `loca_city` = 'tw' or `loca_city` = '
于 2013-07-16T07:10:52.857 に答える