[英]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.