当前位置:网站首页>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边栏推荐
- One hot code
- 软件测试周刊(第78期):你对未来越有信心,你对现在越有耐心。
- Based on MCU, how to realize OTA differential upgrade with zero code and no development?
- Hongmeng third training (project training)
- 基于I2C协议的驱动开发
- Programmers' entrepreneurial trap: taking private jobs
- C language two-dimensional array
- 2022 northeast four provinces match VP record / supplementary questions
- Viewing binary bin files with notepad++ editor
- repo ~ 常用命令
猜你喜欢

Cuiyusong, CTO of youzan: the core goal of Jarvis is to make products smarter and more reliable

Modular programming of single chip microcomputer

用了这么久线程池,你真的知道如何合理配置线程数吗?

How should intermediate software designers prepare for the soft test

STL教程10-容器共性和使用场景

Abandon the Internet after 00: don't want to enter a big factory after graduation, but go to the most fashionable Web3

Encapsulate a koa distributed locking middleware to solve the problem of idempotent or repeated requests

FL Studio 20无限试用版水果编曲下载

C语言 AES加解密

Mmc5603nj geomagnetic sensor (Compass example)
随机推荐
Xml的(DTD,xml解析,xml建模)
Kubernetes 三打探针及探针方式
[OBS] configFile in ini format of OBS
POI excel cell wrap
导师对帮助研究生顺利完成学业提出了20条劝告:第一,不要有度假休息的打算.....
P3250 [hnoi2016] Network + [necpc2022] f.tree path tree section + segment tree maintenance heap
Hongmeng third training (project training)
基于I2C协议的驱动开发
R language uses data The table package performs data aggregation statistics, calculates window statistics, calculates the median of sliding groups, and merges the generated statistical data into the o
金额计算用 BigDecimal 就万无一失了?看看这五个坑吧~~
Yintai department store ignites the city's "night economy"
Asyncio warning deprecationwarning: there is no current event loop
STL教程9-容器元素深拷贝和浅拷贝问题
多维度监控:智能监控的数据基础
DS90UB949
PHP Basics
PHP基础
Excel快速跨表复制粘贴
鸿蒙第四次培训
Using onvif protocol to operate the device