以下の2つのクエリには多少の違いがあります。where句の違い - inとnot in
Query1を:
select distinct source from BUDGET where product_code in
(select distinct PRODUCT_CODE from BUDGET where PRODUCT_CODE not in
(select distinct PRODUCT_CODE from PRODUCT_MASTER)
and PRODUCT_CODE not in
(select distinct PRODUCT_CODE from CVM)
and(VERSION_ID like '17%'
or VERSION_ID like '18%')
)
クエリ2:
select distinct SOURCE from BUDGET where PRODUCT_CODE not in
(select distinct PRODUCT_CODE from PRODUCT_MASTER)
and PRODUCT_CODE not in
(select distinct PRODUCT_CODE from CVM)
and(VERSION_ID like '17%'
or VERSION_ID like '18%')
私は、製品コードproduct_masterとCVMの両方に含まれていない製品のソースが欲しいです。上記の2つのクエリを試してみます。両方とも異なる結果セットを返します。両方のクエリの違いを理解するのに役立つ人がいますか?
ありがとうございました!