sql 两个表字段叠加

要求: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;

 

posted @ 2020-07-15 11:55  硕果磊磊  阅读(714)  评论(0编辑  收藏  举报