У меня есть запрос t-sql, который я конвертирую в 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 Я пытаюсь достичь:
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
Есть предложения?