mysql教程 union 语法详细说明与实例教程
本文介绍如何在mysql中使用union来组合成一个单一的结果
union语法
select field1, field2 ...union [all | distinct]select field1, field2 ...
下面看一款查询三个表普通方法
select brand from car;
select brand from computer;
select brand from clothing;
我们利用union连接起来查询
select brand from car union select brand from computer union select brand from clothing;
select brand from car union all select brand from computer union allselect brand from clothing;
时间: 2024-10-02 10:13:51