SQL2005选择确定位置的记录

select * from(select row_number() over(order by 列1) as num, 列1,列2,列3 from 表名 ) as tempTab where num=5

例子:选取Guestbook数据表的第五条记录
SELECT     *
FROM         (SELECT     row_number() OVER (ORDER BY time) AS num, *
FROM         guestbook) AS tempTab
WHERE     num = 5

猜你喜欢

转载自110shen110.iteye.com/blog/2191700