当前位置:网站首页>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
边栏推荐
- Kubernetes 三打探针及探针方式
- 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?
- R language uses grid of gridextra package The array function combines multiple visual images of the lattice package horizontally, and the ncol parameter defines the number of columns of the combined g
- How to become a senior digital IC Design Engineer (1-3) Verilog coding syntax: Verilog behavior level, register transfer level, gate level (abstract level)
- Software testing weekly (issue 78): the more confident you are about the future, the more patient you are about the present.
- Use typora to draw flow chart, sequence diagram, sequence diagram, Gantt chart, etc. for detailed explanation
- JGG专刊征稿:时空组学
- 一些常用术语
- AI模型看看视频,就学会了玩《我的世界》:砍树、造箱子、制作石镐样样不差...
- Processes and threads
猜你喜欢
How to clean up v$rman_ backup_ job_ Details view reports error ora-02030
鸿蒙第三次培训(项目实训)
Viewing binary bin files with notepad++ editor
Numpy np. Max and np Maximum implements the relu function
C language AES encryption and decryption
Cuiyusong, CTO of youzan: the core goal of Jarvis is to make products smarter and more reliable
Spl06-007 air pressure sensor (example of barometer)
Understand go language context in one article
LeetCode 46:全排列
Qt+VTK+OCCT读取IGES/STEP模型
随机推荐
Oracle 11g single machine cold standby database
Modular programming of single chip microcomputer
Spl06-007 air pressure sensor (example of barometer)
repo ~ 常用命令
MATLAB提取不規則txt文件中的數值數據(簡單且實用)
phpcms 提示信息页面跳转showmessage
PHP server interacts with redis with a large number of close_ Wait analysis
Use typora to draw flow chart, sequence diagram, sequence diagram, Gantt chart, etc. for detailed explanation
鸿蒙第四次培训
Mysql根据时间搜索常用方法整理
Programmers' entrepreneurial trap: taking private jobs
Machine learning 3.2 decision tree model learning notes (to be supplemented)
How to make others fear you
Leetcode 46: full arrangement
After a month, I finally got Kingdee offer! Share tetrahedral Sutra + review materials
C语言日志库zlog基本使用
R语言使用gridExtra包的grid.arrange函数将ggplot2包的多个可视化图像横向组合起来,ncol参数自定义组合图列数、nrow参数自定义组合图行数
Kubernetes 三打探针及探针方式
Program process management tool -go Supervisor
[OBS] configFile in ini format of OBS