2023-11-07
子查询中支持对外表的列使用聚合函数吗?
子查询中支持对外表的列使用聚合函数吗?如下示例:
CREATE TABLE test2 (
id varchar NULL,
a numeric NULL
);
insert into test2
CREATE TABLE test3 (
id varchar NULL,
b numeric NULL
);
insert into test2 values('1','2');
insert into test2 values('2','3');
insert into test3 values('1','2');
insert into test3 values('2','3');
select
*
from
test2 A
where
A.id = '1'
and exists (
select
1
from
test3 B
where
A.id = B.id
group by
B.b,
B.id
having
sum(B.b) <sum(A.a) );
复制
在Oracle中SELECT是能正常执行的,不知道国内的哪家数据库能支持以上用法?
我来答
添加附件
收藏
分享
问题补充
1条回答
默认
最新
回答交流
Markdown
请输入正文
提交
问题信息
请登录之后查看
邀请回答
暂无人订阅该标签,敬请期待~~
