sqlserver 2000 的分页语句 网上有种写法是这样的:
select top PAGESIZE * from
components where id not in (select top (PAGESIZE*(CURRENTPAGE-1)) id from
components order by id)order by id 我想问 比如一张产品表里 有这些字段: id(主键 自增) name(产品名称) sortid(产品分类)
我想把 sortid = 2 的产品 分页查出来 应该怎么写啊这里的 sortid = 后面的 2 是变量
select top PAGESIZE * from
components where id not in (select top (PAGESIZE*(CURRENTPAGE-1)) id from
components order by id)order by id 我想问 比如一张产品表里 有这些字段: id(主键 自增) name(产品名称) sortid(产品分类)
我想把 sortid = 2 的产品 分页查出来 应该怎么写啊这里的 sortid = 后面的 2 是变量
select @s='select top '+ltrim(@PAGESIZE)+' * from
components where id not in (select top '+ltrim(@PAGESIZE*(@CURRENTPAGE-1))+' id from
components order by id)order by id '
exec(@s)
select top (@PAGESIZE) * from
components where id not in (select top (@PAGESIZE*(@CURRENTPAGE-1)) id from
components order by id)order by id SQL2000只能用变量来拼。
sortid 表示 国产服装,进口服装等等分类 现在要吧 国产服装 取出来 分页显示 sql语句怎么写
是sqlserver2000 不用存储过程 谢谢大侠们
select top 20 id,name,sortid from components
where sortid = '值'
and id > 10这个是第二页的,,,你测试哈巴,,我也是新手
select @s='select top '+ltrim(@PAGESIZE)+' * from
components where sortid = '+@sortid+' and id not in (select top '+ltrim(@PAGESIZE*(@CURRENTPAGE-1))+' id from
components sortid = '+@sortid+' order by id)order by id '
exec(@s)
select @s='select top '+ltrim(@PAGESIZE)+' * from
components where sortid = '+@sortid+' and id not in (select top '+ltrim(@PAGESIZE*(@CURRENTPAGE-1))+' id from
components where sortid = '+@sortid+' order by id)order by id '
exec(@s)