合并结果集
union 去除重复并且合并
union all 不去重复的记录
技巧: 要求合并的多个结果集中 列的类型和 列的数量必须相同
create table test1(
tid number(2),
tname varchar2(20)
);
insert into test1 values(1,'a');
insert into test1 values(2,'b');
insert into test1 values(3,'c');
commit;
select * from test1;
create table test2(
did number(2),
dname varchar2(20)
);
insert into test2 values(3,'c');
insert into test2 values(4,'d');
insert into test2 values(5,'f');
commit;
把查询 结果 合并成一个集
union -- 结果集去除重复的
select * from test1
union
select * from test2;
union all-- 结果集不去除重复
select * from test1
union all
select * from test2;
多表查询_合并结果集
最新推荐文章于 2024-06-27 13:23:36 发布
2829

被折叠的 条评论
为什么被折叠?



