sql server 2008 rownumber 分页sql语句

SELECT
ID,TSRID, plid,CustomerName,SellCode,Mobile ,ReserveTime,CrtTime,hjtime,jieshuma ,
InsureBillCode, tname,bname,shoucang,xingbie,ActivityName ,sydate,AddInsuranceID 
FROM
-----------------------------------------------
(

SELECT *,ROW_NUMBER() OVER (ORDER BY hjtime desc) AS RowNo

FROM [C_V_SellData] 

where
CrtUser=358
and StoreType=1 
and EndCode <> 1 
and EndCode <> 5 
and hjtime  >= cast(convert(varchar,'2014/1/18',111) as datetime) 
and hjtime <  cast(convert(varchar,'2014/2/18',111) as datetime) + 1
and isnull(AddInsuranceID,'')<>'N'  ) AS A 


--------------------------------------------------
WHERE   RowNo>=1  and RowNo<=50

posted on 2014-02-18 15:59  zyf  阅读(346)  评论(0编辑  收藏  举报

导航