分页查询

sqlServer:


SELECT * 

  FROM (
SELECT ROW_NUMBER() OVER (order by T.EventID desc)AS Row, T.*  
 from Event T  
WHERE EventType = '1'  
  and UserID = '1'  ) TT 

 WHERE TT.Row between 4 and 6

效率比较差,需改善。

你可能感兴趣的:(分页查询)