sql 分頁

 

DECLARE @PageIndex INT=1;
DECLARE @PageSize INT=10;it


SELECT COUNT(1) As SumCount,@PageIndex AS PageIndex,@PageSize AS PageSize FROM (db

--主體內容--di

SELECT GeneralID,Title,NodeID,Area_Province,Area_City,Price,Hits,Status,ISNULL(Editor,'') AS Editor FROM dbo.PE_CommonModel INNER JOIN dbo.PE_U_SecondHand ON GeneralID=ID

) A;

SELECT * FROM (
SELECT TOP (@PageIndex*@PageSize) ROW_NUMBER() OVER (ORDER BY GeneralID desc) PageNumber,* FROM (vi

--主體內容--co

 

SELECT GeneralID,Title,NodeID,Area_Province,Area_City,Price,Hits,Status,ISNULL(Editor,'') AS Editor FROM dbo.PE_CommonModel INNER JOIN dbo.PE_U_SecondHand ON GeneralID=ID

)A) A WHERE PageNumber>((@PageIndex-1)*@PageSize);

相關文章
相關標籤/搜索