union all 用法

来源:互联网 发布:知乐小说全集百度云txt 编辑:程序博客网 时间:2024/04/29 18:50

sql语句将两个字段合并成一个字段,显示不重复的记录

 

select countrycode as chargecountrycode  from (select  countrycode  from COUNTRYGROUP  union    select  chargecountrycode  from COUNTRYGROUP  )  where countrycode != -1

 

两个字段合并成一个字段,显示重复的记录 用union all

 

select countrycode as chargecountrycode  from (select  countrycode  from COUNTRYGROUP  union all    select  chargecountrycode  from COUNTRYGROUP  )  where countrycode != -1