select code from A
union 
select code from B即可!

解决方案 »

  1.   

    select * from a
    union all
    select * from b
      

  2.   

    你这里的数据用union 和union all都是一样
    不过如果原来a不是升序,b也不是升序,并且未必b中都比a大
    那么如果你要结果集合按照升序并且重复去掉,那么你用union,她除了默认自动按照升序并且重复的去掉,不过如果用在很多表关联,考虑速度,你不介意重复,用union all,系统用的时间少点FYI
      

  3.   

    学习,原来UNION和UNION ALL有这样的差异啊,
    感谢  MorningTea(一勺抹茶) MM