动易标签分页

动易标签分页_第1张图片


SELECT  top @pagesize .....
WHERE    .... AND (dbo.PE_CommonModel.GeneralID NOT IN (SELECT  top @startrow ....))
ORDER BY ....

SELECT  count(dbo.PE_CommonModel.GeneralID)
....

注意,后面的SQL语句不能有order by


下面是显示文章标题和简介的语句

SELECT     TOP (@pagesize) dbo.PE_CommonModel.GeneralID, dbo.PE_CommonModel.NodeID, dbo.PE_CommonModel.ItemID, dbo.PE_CommonModel.Title, dbo.PE_U_Article.Intro
FROM         dbo.PE_CommonModel INNER JOIN
                      dbo.PE_U_Article ON dbo.PE_CommonModel.ItemID = dbo.PE_U_Article.ID
WHERE     (dbo.PE_CommonModel.ModelID = 1) AND (dbo.PE_CommonModel.Status = 99) AND (dbo.PE_CommonModel.NodeID = @NodeID) AND 
                      (dbo.PE_CommonModel.GeneralID NOT IN
                          (SELECT     TOP (@startrow) PE_CommonModel_1.GeneralID
                            FROM          dbo.PE_CommonModel AS PE_CommonModel_1 INNER JOIN
                                                   dbo.PE_U_Article AS PE_U_Article_1 ON PE_CommonModel_1.ItemID = PE_U_Article_1.ID
                            WHERE      (PE_CommonModel_1.ModelID = 1) AND (PE_CommonModel_1.Status = 99) AND (PE_CommonModel_1.NodeID = @NodeID)
                            ORDER BY PE_CommonModel_1.GeneralID DESC))
ORDER BY dbo.PE_CommonModel.GeneralID DESC

SELECT count(dbo.PE_CommonModel.GeneralID)  FROM PE_CommonModel INNER JOIN PE_U_Article ON PE_CommonModel.ItemID = PE_U_Article.ID  WHERE  (PE_CommonModel.NodeID = @NodeID)   (dbo.PE_CommonModel.ModelID = 1) AND (dbo.PE_CommonModel.Status = 99)



调用方式:

{PE.Label id="mobilelistbypage" nodeID="@RequestInt_Id" pagesize="6" page="true"/}

分页按钮:

   


你可能感兴趣的:(网站管理员日记,前台开发资料)