gpt4 book ai didi

hadoop - 配置单元错误 : For Exists/Not Exists operator SubQuery must be Correlated

转载 作者:可可西里 更新时间:2023-11-01 16:36:27 26 4
gpt4 key购买 nike

select * from students1;

students1.name students1.age students1.gpa
fred 35 1.28
barney 32 2.32
shyam 32 2.32

select * from students2;
students1.name students1.age
fred 35
barney 32

当我运行这个查询时

select 
name,age from students1
where not exists
(select name,age from students2);

我收到这个波纹管错误

Error while compiling statement: FAILED: SemanticException line 39:22 Invalid SubQuery expression 'age' in definition of SubQuery sq_1 [ exists (select name,age from students2) ] used as sq_1 at Line 3:10: For Exists/Not Exists operator SubQuery must be Correlated.

最佳答案

错误信息很清楚。使用exists/not exists时,子查询应该相关。

select name,age 
from students1 s1
where not exists (select 1
from students2 s2
where s1.name=s2.name and s1.age=s2.age
)

关于hadoop - 配置单元错误 : For Exists/Not Exists operator SubQuery must be Correlated,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51767158/

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