日期:2014-05-18 浏览次数:20595 次
select no=row_number() over(order by getdate()) from ...
------解决方案--------------------
SQL2000?2005?
2005:
select * from( select tb.id,tb.title,px = row_number() over(order by getdate()) from ( select id,title from table1 union select id,title from table2 ) td )te where px between 1 and 10
------解决方案--------------------
2005或是2008用row_number即可。
------解决方案--------------------
select row_number() over(order by id) tb.id,tb.title from (
select id,title from table1
union
select id,title from table2
) td
------解决方案--------------------
select row_number() over(order by id) tb.id,tb.title from ( select id,title from table1 union select id,title from table2 ) td
------解决方案--------------------
2000用identity