1
我有一個t-sql查詢轉換爲nHibernate。在nHibernate中設置最大等於 - 投影
我已經得到接近,但我在各地的max函數難
我嘗試:
C#
var itemsQuery = queryOver.Clone()
.OrderBy(a =>a.liveStartTime).Asc
.Select(Projections.GroupProperty(Projections.Property<ChannelFind>(a => a.channelID)), Projections.Max<ChannelFind>(a => a.liveStartTime))
輸出:
SELECT TOP (20 /* @p0 */) this_0_.channelID as y0_,
max(this_0_.liveStartTime) as y1_
FROM vTGv0_channel_Find this_0_
GROUP BY this_0_.channelID
ORDER BY this_0_.liveStartTime asc
這是SQL 0的我試圖實現:
SELECT TOP (20 /* @p0 */) this_0_.channelID as y0_, liveStartTime = max(this_0_.liveStartTime)
FROM vTGv0_channel_Find this_0_
GROUP BY this_0_.channelID
ORDER BY liveStartTime asc
有什麼建議?