22,206
社区成员
发帖
与我相关
我的任务
分享
select me.*,mr.rentid from m_equipmentinfo as me,m_rentinfo as mr
where me.em_id in (6,6) and mr.rentid in(select cl_lfiid from m_contractleasefacilityinfo
where cl_contractinfoid=38)
SELECT TOP 页大小 *
FROM
(
SELECT ROW_NUMBER() OVER (ORDER BY id) AS RowNumber,* FROM (select me.*,mr.rentid from m_equipmentinfo as me,m_rentinfo as mr
where me.em_id in (6,6) and mr.rentid in(select cl_lfiid from m_contractleasefacilityinfo
where cl_contractinfoid=38) ) table1
) A
WHERE RowNumber > 页大小*(页数-1)
--@PAGE是页数,@PAGECOUNT是每页数量
DECLARE @PAGE INT,@PAGECOUNT INT
SELECT @PAGE=2,@PAGECOUNT=10
SELECT * FROM (
select me.*,mr.rentid
,ROW_NUMBER() OVER (ORDER BY COL1 ASC) AS NID
--COL1为假设的分页排序字段,换成你的字段名
from m_equipmentinfo as me,m_rentinfo as mr
where me.em_id in (6,6) and mr.rentid in(select cl_lfiid from m_contractleasefacilityinfo
where cl_contractinfoid=38)
) T WHERE NID BETWEEN @PAGECOUNT*(@PAGE-1)+1 AND @PAGECOUNT*@PAGE