首页 > 数据库技术 > 详细

sql 两个表字段叠加

时间:2020-07-15 13:48:28      阅读:45      评论:0      收藏:0      [点我收藏+]

要求:tableA表字段A与tableB表字段B叠加显示

代码:

select A as AB from tableA union all select distinct B from tableB;

添加条件:字段唯一显示

select distinct A as AB from tableA union all select distinct B from tableB;

添加条件:字段唯一显示,字段递减

select distinct A as AB from tableA union all select distinct B from tableB order by AB asc;

添加条件:字段唯一显示,字段递减,过滤重复

select distinct A as AB from tableA union select distinct B from tableB order by AB asc;

 

sql 两个表字段叠加

原文:https://www.cnblogs.com/shuoguoleilei/p/13304733.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!