具有分页功能的Web服务,但不显示行号

时间:2018-10-05 07:45:35

标签: sql-server pagination

所以我有这个网络服务,可以像这样进行sql排序查询:

declare @pagerows int select @pagerows = 5
declare @pageindex int select @pageindex = 1 

select * from (select ROW_NUMBER() over(order by lm.PostNr, lm.Adress) Row, lm.Adress, lm.PostNr, p.CityName, e.DepartmentName, lm.Adress + ', ' + lm.PostNr + ', ' + p.CityName as FullAdress 
from Housing lm 
inner join Department e on lm.HeadNr = e.HeadNr and lm.DepartmentNr = e.DepartmentNr 
inner join PostNr p on lm.PostNr = p.PostNr 
where lm.Types in (31, 32, 33) and lm.Adress like 'whatever%'
group by lm.Adress, lm.PostNr, p.CityName, e.DepartmentName) a
where Row between(@pageRows* @pageindex) -@pageRows + 1 and(@pageRows * @pageindex)

现在,我实际上并不想在输出中包含行号,但是我不确定如何删除它,仍然可以进行分页。

基本上我如何从select语句中删除ROW_NUMBER() over(order by lm.PostNr, lm.Adress) Row,部分,但仍保持分页功能正常?

0 个答案:

没有答案