select aaa.BookId from
(SELECT TOP (100) PERCENT Id, BookId,CreatedOnUtc
FROM dbo.Chapter AS c
ORDER BY CreatedOnUtc desc
) as aaa
group by aaa.BookId
为什么 ORDER BY CreatedOnUtc desc 对结果没有任何影响。
我想得到这样的结果
BookId (with desc createdonUtc)
3
4
1
...
更新:我同意这个
select BookId, Max(CreatedOnUtc)
from Chapter
group by BookId
order by Max(CreatedOnUtc) desc