![](/img/trans.png)
[英]Select timestamps with different field names from two tables, and order them?
[英]Select from two tables with different order column
我有两个表,每个表三列:
tbl_music
(id, title, reg_time)tbl_movie
(id, title, time_log) 对于sitemap.xml
我想按时间按文件顺序添加两个表中的所有项目。 这两个表是分开的,时间字段是reg_time
和time_log
。
如何连接两个表并从两个表上的值排序?
在以下情况下,结果集包括tbl_music
和tbl_movie
表的内容
select * from
( select id, title, reg_time as time from tbl_music
union all
select id, title, time_log as time from tbl_movie
) results
order by time
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.