代码改变世界

分页。刚学的。Row_Number() Over

2011-04-25 16:10  沐海  阅读(269)  评论(0编辑  收藏  举报

select * from (select distinct id, Row_Number() Over(order by Creattime desc) As rownum, Creattime from ActivityInfo) as d where rownum between 21 And 30 order by Creattime desc

 


string SQL1="select HelpId from (select distinct HelpId, Row_Number() Over(order by Creattime desc) As rownum, Creattime from  HelpAnswer) as d where rownum between ("+pageIndex+"-1)*15+1 And "+pageIndex+"*15 order by Creattime desc";

记录生活、工作、学习点滴!
E-Mail:mahaisong@hotmail.com 欢迎大家讨论。
沐海博客园,我有一颗,卓越的心!