当前位置:网站首页>MySQL union和union all区别
MySQL union和union all区别
2022-07-03 10:58:00 【inexaustible】
union:对多个结果集(select语句)进行并集操作,不包括重复行,同时进行排序。
union all:对多个结果集(select语句)进行并集操作,包括重复行,不进行排序。
内部的select语句必须拥有相同数量的列,列也必须拥有相似的数据类型,同时每条select语句的列的顺序必须相同。
select A.*
from
(
SELECT 1 flag,t.id,t.name,t.status,t.task_type,u.nickname,t.create_time,t.end_time,t.start_time,t.creator
from camas_survey_task t,system_user u
where t.status = 3 and t.deleted = 0 and t.creator = u.id
union all
select 2 flag,mr.id,mr.name,mr.status,-1 task_type,u.nickname,mr.create_time,mr.end_time,mr.start_time,mr.creator
from camas_survey_monitor_rule mr,system_user u
where mr.status = 3 and mr.deleted = 0 and mr.creator = u.id
)A
order by A.start_time asc边栏推荐
- C language AES encryption and decryption
- One hot code
- ASP.NET-酒店管理系统
- Application of high-precision indoor positioning technology in safety management of smart factory
- [vtk] interpretation of source code comments of vtkwindowedsincpolydatafilter
- 程序员的创业陷阱:接私活
- Google Earth engine (GEE) -- when we use the front and back images to make up for the interpolation effect, what if there is no effect?
- How to get started embedded future development direction of embedded
- GCC compilation process and dynamic link library and static link library
- 软考中级软件设计师该怎么备考
猜你喜欢

Incremental database backup - DB incr DB full

软件测试周刊(第78期):你对未来越有信心,你对现在越有耐心。

How to clean up v$rman_ backup_ job_ Details view reports error ora-02030

Redis things

Yintai department store ignites the city's "night economy"

The world's most popular font editor FontCreator tool

uniapp scroll view 解决高度自适应、弹框滚动穿透等问题。

ASP. Net hotel management system

【学习笔记】dp 状态与转移

Use typora to draw flow chart, sequence diagram, sequence diagram, Gantt chart, etc. for detailed explanation
随机推荐
After setting up ADG, instance 2 cannot start ora-29760: instance_ number parameter not specified
Tablespace creation management and control file management
Kibana~Kibana的安装和配置
Event preview | the live broadcast industry "rolled in" to drive new data growth points with product power
STL教程9-容器元素深拷贝和浅拷贝问题
基于turtlebot3实现SLAM建图及自主导航仿真
按键切换:按F1-F12都需要按Fn
.\vmware-vdiskmanager.exe -k “c:\\xxxxx.vmdk”
C语言日志库zlog基本使用
Web安全总结
导师对帮助研究生顺利完成学业提出了20条劝告:第一,不要有度假休息的打算.....
Based on MCU, how to realize OTA differential upgrade with zero code and no development?
R语言使用gridExtra包的grid.arrange函数将lattice包的多个可视化图像横向组合起来,ncol参数自定义组合图列数、nrow参数自定义组合图行数
Uniapp implementation Click to load more
Redis things
[OBS] configFile in ini format of OBS
并发编程-单例
Project management essence reading notes (VII)
如何将数字字符串转换为整数
Oracle 11g single machine cold standby database