sql server常用语句

按时间查询最近的阶段并显示5条数据:select top 5 字段 from 表 order by 字段的时间 desc

分页的高效率的语句:SELECT  *from
(SELECT Id, UserName, Age, Sex, IsVIP,row_number() over(order by id) rownum FROM dbo.T_USERS)t
where t.rownum>@startRowIndex and t.rownum<=@startRowIndex+@maximunRows

posted on 2012-06-08 23:35  仙梦之飘  阅读(136)  评论(0编辑  收藏  举报