日期:2014-05-18  浏览次数:20453 次

UNION ALL
通过
select     *   from   A
UNION       ALL  
select   *   from   B
查询后怎样将A,B两个表同时排序啊
而且要A表的数据排序完成后,在将B表排序啊。


------解决方案--------------------
select col1,col2,col3 from
(select 0 as sn,col1,col2,col3 from A
UNION ALL
select 1 as sn,col1,col2,col3 from B) t
order by sn,其它要排序的列