日期:2014-05-18 浏览次数:20461 次
create table #t1(mesid int) insert #t1 select 10 union all select 9 create table #t2(mesid int) insert #t2 select 9 union all select 8 union all select 7 select id=identity(int,1,1),mesid into #t3 from ( select mesid from #t1 union all select mesid from #t2 ) as a select mesid from #t3 a where id=(select min(id) from #t3 where mesid=a.mesid) order by id /* 10 9 8 7 */ drop table #t1,#t2,#t3