日期:2014-05-18 浏览次数:20528 次
create table a(id int,title varchar(10),addtime datetime) insert into a values(1, 'aaa', '2007-02-23') insert into a values(2, 'bbb', '2007-06-05') create table b(id int,title varchar(10),addtime datetime) insert into a values(1, 'assf', '2007-03-23') insert into a values(2, 'dfsd', '2007-05-05') go select addtime , title from a union all select addtime , title from b order by a.addtime desc drop table a,b /* addtime title ------------------------------------------------------ ---------- 2007-06-05 00:00:00.000 bbb 2007-05-05 00:00:00.000 dfsd 2007-03-23 00:00:00.000 assf 2007-02-23 00:00:00.000 aaa (所影响的行数为 4 行) */
------解决方案--------------------
select addtime,title from a union all select addtime,title from b order by addtime desc
------解决方案--------------------
使用 union
------解决方案--------------------
SQL codeselect addtime,title from a
union all
select addtime,title from b order by addtime desc