union all 三次查询
时间: 2023-12-21 22:02:44 浏览: 129
Sql学习第一天——SQL UNION 和 UNION ALL 操作符认识
使用union all进行三次查询的语法可以如下所示:
(select * from table1)
union all
(select * from table2)
union all
(select * from table3)
这个语句会将table1、table2和table3中的所有符合条件的查询结果合并在一起,并且保留重复的结果。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [Mysql联合查询UNION和UNION ALL的使用介绍](https://blog.csdn.net/weixin_33850554/article/details/113972334)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* [使用union all优化or查询速度](https://blog.csdn.net/weixin_39741459/article/details/113909653)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文