码迷,mamicode.com
首页 > 其他好文 > 详细

UNION 与 UNION ALL

时间:2014-11-05 14:59:04      阅读:128      评论:0      收藏:0      [点我收藏+]

标签:union 与 union all   union   union all   sql union   

SQL UNION 操作符

UNION 操作符用于合并两个或多个 SELECT 语句的结果集。

请注意,UNION 内部的 SELECT 语句必须拥有相同数量的列。列也必须拥有相似的数据类型。同时,每条 SELECT 语句中的列的顺序必须相同。

SQL UNION 语法(排除重复的数据)

select * from stu

union

select * from stu

SQL UNION ALL 语法(不排除重复的数据)

select * from stu

union all

select * from stu

本文出自 “程序猿的家--Hunter” 博客,请务必保留此出处http://962410314.blog.51cto.com/7563109/1572108

UNION 与 UNION ALL

标签:union 与 union all   union   union all   sql union   

原文地址:http://962410314.blog.51cto.com/7563109/1572108

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!