0
我想從兩個表無法從兩個表
select AVP_KEY
(SELECT AVP_KEY FROM AVP_KEY WHERE AVP_KEY in(SELECT DISTINCT NEW_AVP_KEY FROM GTT_STG_ITEM_ATTR_AVP WHERE ATTRIBUTE_GROUP_ID IN(SELECT ATTRIBUTE_GROUP_ID FROM GTT_STG_ITEM_ATTR_AVP WHERE INSERT_TYPE=2
MINUS
SELECT ATTRIBUTE_GROUP_ID FROM GTT_STG_ITEM_ATTR_AVP WHERE INSERT_TYPE=1)))
WHERE
AVP_KEY NOT IN
(SELECT DISTINCT AVP_KEY FROM STG_IT_ATTRIBUTE PARTITION(STG_IT_ATTRIBUTE2460785) WHERE JOB_LOG_ID=2460785 AND CLIENT_ID=355);
編輯您的問題,並提供樣本數據和期望的結果。 –
「獨特價值」是什麼意思?設置理論操作'MINUS'可能不是正確的工具,但它取決於你真正想做的事情。 – mathguy
這意味着像SELECT AVP_KEY FROM AVP_KEY WHERE AVP_KEY在(SELECT DISTINCT NEW_AVP_KEY FROM GTT_STG_ITEM_ATTR_AVP WHERE ATTRIBUTE_GROUP_ID IN(SELECT ATTRIBUTE_GROUP_ID FROM GTT_STG_ITEM_ATTR_AVP WHERE INSERT_TYPE = 2 MINUS SELECT ATTRIBUTE_GROUP_ID FROM GTT_STG_ITEM_ATTR_AVP WHERE INSERT_TYPE = 1))返回箱1,2,3和SELECT DISTINCT AVP_KEY FROM STG_IT_ATTRIBUTE PARTITION(STG_IT_ATTRIBUTE2460785)WHERE JOB_LOG_ID = 2460785 AND CLIENT_ID = 355返回我1,2,3,4我需要4作爲輸出 –