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;

 

sql 两个表字段叠加

上一篇:python 学习(三)数据库、EXCEL处理


下一篇:CentOS7 SELinux阻止MongoDB启动的问题