首页 > 数据库技术 > 详细

mysql_DML_select_union

时间:2016-09-22 19:35:45      阅读:181      评论:0      收藏:0      [点我收藏+]

使用union可以将多个select 语句的查询结果集组合成一个结果集。
select 字段列表1 from table1
union [all]
select 字段列表2 from table2...
说明:字段列表1与字段列表2的字段个数必须相同,且具有相同的数据类型。合
并产生的新结果集的字段名与字段列表1中的字段名对应。

eg:

select stu_id,stu_name from teacher

union 

select stu_id,stu_name from stu;

union 和union all  前者去重 后者不去重

mysql_DML_select_union

原文:http://www.cnblogs.com/lingxia/p/5897362.html

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