热线电话:13121318867

登录
2020-03-02 阅读量: 690
联合查询union和union all的用法

union用于合并两个或多个 SELECT 语句的结果集,并消去表中任何重复行

例: 用union合并t1与t2表

select t1.* from t1

union

select t2.* from t2;

union all:用于合并两个或多个 SELECT 语句的结果集,保留重复行

例: 用union all合并t1与t2表

select t1.* from t1

union all

select t2.* from t2;

0.0000
0
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子