您的位置:首页 > 数据库 > MySQL

MySQL多个相同结构的表查询并把结果合并放在一起的语句(union all)

2017-10-23 17:40 726 查看
union all

select * from table1001 where price > 10
union all
select * from table1002 where price > 10
union all
select * from table1003 where price > 10
order by ID


列的个数要保持一致,列名可以不一样,但是对应的列的数据类型要一样。同样可以使用order by,limit这些。

参考:

http://bbs.51cto.com/thread-1076108-1-1.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: