真是不好意思,没有说清楚 后台用的是ibatis 是不知道怎么把sql语句转换成ibatis格式的 不知道下面代码问号的地方怎么写 <select id="GetTestRankingList" parameterClass="map" resultClass="IPhotoInfo"> SELECT [Id] ,[UserID] ,[ImageURL] ,[GoreCount] ,[ThreadCount] ,[IsDelete] FROM (SELECT <isPropertyAvailable property="Top" prepend=""> Top (#Top#) </isPropertyAvailable> ROW_NUMBER() OVER (order by ????? as RowNumber, [Id] ,[UserID] ,[ImageURL] ,[GoreCount] ,[ThreadCount] ,[IsDelete] FROM [S_Impression].[dbo].[TIPhoto] )t <dynamic prepend="WHERE"> <isPropertyAvailable property="StartRecord" prepend="AND"> RowNumber>#StartRecord# </isPropertyAvailable> </dynamic> </select>
ROW_NUMBER() OVER (order by NUM2) as RowNumber
SELECT Top(10) [Id] ,[UserID] ,[ImageURL] ,[GoreCount] ,[ThreadCount] ,[IsDelete] FROM ( SELECT ROW_NUMBER() OVER (order by ISNULL(NUM1,0)+ISNULL(NUM2,0)-ISNULL(NUM1,0) DESC) as RowNumber, [Id] ,[UserID] ,[ImageURL] ,[GoreCount] ,[ThreadCount] ,[IsDelete] FROM [S_Impression].[dbo].[TIPhoto] )t ORDER BY RowNumber
FROM TB
ORDER BY NUM2 DESC
SELECT *
FROM TB
ORDER BY NUM1+NUM2-NUM1 DESC
和直接num2有什么不同?用isnull处理null为0,效果也是相同的呀?
后台用的是ibatis
是不知道怎么把sql语句转换成ibatis格式的 不知道下面代码问号的地方怎么写
<select id="GetTestRankingList" parameterClass="map" resultClass="IPhotoInfo">
SELECT [Id] ,[UserID] ,[ImageURL] ,[GoreCount] ,[ThreadCount] ,[IsDelete] FROM
(SELECT
<isPropertyAvailable property="Top" prepend="">
Top (#Top#)
</isPropertyAvailable>
ROW_NUMBER() OVER (order by ????? as RowNumber,
[Id] ,[UserID] ,[ImageURL] ,[GoreCount] ,[ThreadCount] ,[IsDelete] FROM [S_Impression].[dbo].[TIPhoto]
)t
<dynamic prepend="WHERE">
<isPropertyAvailable property="StartRecord" prepend="AND">
RowNumber>#StartRecord#
</isPropertyAvailable>
</dynamic>
</select>
[Id] ,[UserID] ,[ImageURL] ,[GoreCount] ,[ThreadCount] ,[IsDelete] FROM
(
SELECT
ROW_NUMBER() OVER (order by ISNULL(NUM1,0)+ISNULL(NUM2,0)-ISNULL(NUM1,0) DESC) as RowNumber,
[Id] ,[UserID] ,[ImageURL] ,[GoreCount] ,[ThreadCount] ,[IsDelete]
FROM [S_Impression].[dbo].[TIPhoto]
)t
ORDER BY RowNumber