排序多个时间戳


MySQL Sort multiple timestamp

我有2表在我的数据库。它们是管理操作表和用户操作。表结构如下::

Admin操作表

Action_id |  order    |   Action_type    |           timestamp          |   
   1          12            pending           2014-07-24 15:30:45
   2          12            packing           2014-08-24 14:12:11 
   3          12            shipping          2013-05-01 15:55:12
   4          12            packing           2011-11-25 21:10:22

User Action表

Action_id |  order    |   Action_type    |           timestamp          |   
   1          12            transfer           2014-07-22 15:30:45
   2          12            transfer           2014-09-23 14:12:11 
   3          12            transfer           2013-05-07 15:55:12
   4          12            transfer           2011-11-28 21:10:22

我想排序时间戳两个表。在这之前或之后发生了什么?最后。结果如下:

活动

Action_id     |   Action_type      |                 timestamp           |
    4               packing                    2011-11-25  21:10:22      //admin action 
    4               transfer                   2011-11-28  21:10:22      //user aciton
    3               shipping                   2013-05-01  15:55:12      //admin action
    3               transfer                   2013-05-07  15:55:12      //user aciton 
    1               transfer                   2014-07-22  15:30:45      //user aciton
    1               pending                    2014-07-24  15:30:40      //admin action
                       .....

MySQL命令是什么来解决这个问题?

我知道我可以在PHP编码算法排序时间戳。但我认为如果从数据库查询好。

这个未经测试的查询应该会给出预期的结果:

select * from (
Select * from `Admin Action`
union all
Select * from `User Action`) as a
order by timestamp