我正在尝试从两个表中获取唯一值
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);
答案 0 :(得分:0)
尝试使用
修改代码SELECT distinct AVP_KEY from (SELECT AVP_KEY FROM AVP_KEY WHERE AVP_KEY IN (SELECT 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 AVP_KEY FROM STG_IT_ATTRIBUTE PARTITION(STG_IT_ATTRIBUTE2460785) WHERE JOB_LOG_ID=2460785 AND CLIENT_ID =355 );
=============================================== =========================