帮忙看一个sql,谢谢
因为数据较多,用了分表
user1
+----+--------+
| id | value |
+----+--------+
| 1 | 2 |
| 2 | 3
+----+--------
user2
+----+--------+
| id | value |
+----+--------+
| 3 | 0 |
| 4 | 4
+----+--------
现在想用一条语句查询 2张表,并根据value 排序,怎么写? 谢谢!
------解决方案--------------------
SQL code
select * from user1
union all
select * from user2
order by value
------解决方案--------------------
一楼正解。
------解决方案--------------------
select * from user1
union all
select * from user2
order by 2