当前位置:网站首页>Differences between MySQL Union and union all
Differences between MySQL Union and union all
2022-07-03 11:53:00 【inexaustible】
union: For multiple result sets (select sentence ) To perform union operations , Do not include repeating lines , Sort at the same time .
union all: For multiple result sets (select sentence ) To perform union operations , Include repeating lines , No sorting .
Inside select Statements must have the same number of columns , Columns must also have similar data types , At the same time, each select The order of the columns of the statement must be the same .
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
边栏推荐
- 优化接口性能
- vulnhub之momentum
- The uniapp scroll view solves the problems of high adaptability and bullet frame rolling penetration.
- Dynamically monitor disk i/o with ZABBIX
- phpcms 提示信息頁面跳轉showmessage
- cgroup简介
- Go语言实现静态服务器
- MySQL uses the method of updating linked tables with update
- R语言使用gridExtra包的grid.arrange函数将lattice包的多个可视化图像横向组合起来,ncol参数自定义组合图列数、nrow参数自定义组合图行数
- Vulnhub pyexp
猜你喜欢
Based on MCU, how to realize OTA differential upgrade with zero code and no development?
Slam mapping and autonomous navigation simulation based on turnlebot3
Vulnhub's Nagini
836. Merge sets (day 63) and search sets
STL教程10-容器共性和使用场景
聊聊Flink框架中的状态管理机制
小鹏 P7 撞护栏安全气囊未弹出,官方回应称撞击力度未达到弹出要求
Web安全总结
Capturing and sorting out external Fiddler -- Conversation bar and filter [2]
Machine learning 3.2 decision tree model learning notes (to be supplemented)
随机推荐
错排问题 (抽奖,发邮件)
P3250 [hnoi2016] Network + [necpc2022] f.tree path tree section + segment tree maintenance heap
OpenStack中的测试分类
Vulnhub's presidential
ftp登录时,报错“530 Login incorrect.Login failed”
Ripper of vulnhub
R语言使用原生包(基础导入包、graphics)中的hist函数可视化直方图(histogram plot)
解决msvcp120d.dll和msvcr120d.dll缺失
Viewing binary bin files with notepad++ editor
利用Zabbix动态监控磁盘I/O
Capturing and sorting out external Fiddler -- Conversation bar and filter [2]
简单工厂和工厂方法模式
Experience container in libvirt
《剑指offer 04》二维数组查找
Hongmeng third training (project training)
Machine learning 3.2 decision tree model learning notes (to be supplemented)
Deploying WordPress instance tutorial under coreos
STL教程8-map
Web security summary
Unity3D学习笔记5——创建子Mesh