select top 1000 * from VIEW_ALMEVT0409 where (evtdate>='2004-09-24' and evtdate<='2004-12-24'  ) and plcname='大钟寺'  union  select top 1000 * from VIEW_ALMEVT0410 where (evtdate>='2004-09-24' and evtdate<='2004-12-24'  ) and plcname='大钟寺'  union  select top 1000 * from VIEW_ALMEVT0411 where (evtdate>='2004-09-24' and evtdate<='2004-12-24'  ) and plcname='大钟寺'
我问我的view_almevt0409,view_almevt0410,view_almevt0411表是动态生成的,(有时就一个view_almevt0409表,有时有6个表).怎么加order by 呀
//参考
加上排序order by 以后为
select t1.a,t2.a,t3.a from (select top 1000 * from VIEW_ALMEVT0409 where (evtdate>='2004-09-24' and evtdate<='2004-12-24' order by  ) and plcname='大钟寺') t1,(select top 1000 * from VIEW_ALMEVT0410 where (evtdate>='2004-09-24' and evtdate<='2004-12-24'  ) and plcname='大钟寺' order by) t2,(select top 1000 * from VIEW_ALMEVT0411 where (evtdate>='2004-09-24' and evtdate<='2004-12-24'  order by) and plcname='大钟寺'
) t3
//////////////////////////////////////////////////////
SELECT t1.*, t2.*, t3.*
FROM (SELECT TOP 1000 *
        FROM VIEW_ALMEVT0409
        WHERE (evtdate = '2004-09-24' AND evtdate = '2004-12-24') AND 
              plcname = '大钟寺'
        ORDER BY AlmID) t1 CROSS JOIN
          (SELECT TOP 1000 *
         FROM VIEW_ALMEVT0410
         WHERE (evtdate = '2004-09-24' AND evtdate = '2004-12-24') AND 
               plcname = '大钟寺'
         ORDER BY AlmID) t2 CROSS JOIN
          (SELECT TOP 1000 *
         FROM VIEW_ALMEVT0411
         WHERE (evtdate = '2004-09-24' AND evtdate = '2004-12-24') AND 
               plcname = '大钟寺'
         ORDER BY AlmID) t3
////////////////////////////////////////////////////
SELECT t1.*, t2.*, t3.*
FROM (SELECT TOP 1000 *
        FROM VIEW_ALMEVT0409
        WHERE (evtdate = '2004-09-24' AND evtdate = '2004-12-24') AND 
              plcname = '大钟寺'
        ORDER BY AlmID) t1,
          (SELECT TOP 1000 *
         FROM VIEW_ALMEVT0410
         WHERE (evtdate = '2004-09-24' AND evtdate = '2004-12-24') AND 
               plcname = '大钟寺'
         ORDER BY AlmID) t2,
          (SELECT TOP 1000 *
         FROM VIEW_ALMEVT0411
         WHERE (evtdate = '2004-09-24' AND evtdate = '2004-12-24') AND 
               plcname = '大钟寺'
         ORDER BY AlmID) t3