关于union和unionall

这个sql关键字的意思是把两个select的结果合并到一个临时表中,unionall的效率高于union,因为union自带去重,unionall是把所有的结果集都显示   

用法举例如下

select name from 表名 where id=条件 union select 要查询的条件 from 表名 where 限制条件

猜你喜欢

转载自www.cnblogs.com/aiyouzi/p/12175935.html