gpt4 book ai didi

mysql - 无法从两个表中获取唯一值

转载 作者:行者123 更新时间:2023-11-29 19:04:07 24 4
gpt4 key购买 nike

我正在尝试从两个表中获取唯一值

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);

最佳答案

尝试修改代码

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 );

================================================== =========================

关于mysql - 无法从两个表中获取唯一值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43645690/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com