首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

sql转access分页语句。该如何解决

2012-05-12 
sql转access分页语句。SQL codeSELECT TOP (@pagesize) id,(select count(commentid) from Comment where c

sql转access分页语句。

SQL code
SELECT TOP (@pagesize) id,(select count(commentid) from Comment where commentparentid=id and commenttype=2  ) as sum2,name,author,date,content,Cover_pic,Views_number  FROM dbo.down WHERE id <= ( SELECT ISNULL(MIN(id),0) FROM ( SELECT TOP (@pagesize*(@page-1)+1) id FROM down ORDER BY id Desc ) A ) ORDER BY id Desc


转access 怎么弄??? 没用过access

[解决办法]
如果数据源数据量小,可以用双top方法;否则用max方法。
sqlStr = String.Format("select top {0} * from 测试 where 学号>(select max(学号) from (select top {1} 学号 from 测试))", pageSize, ((pageIndex - 1) * pageSize));

热点排行