0
我有一个表列AppId
,Comment
,TimeStamp
。表格可以有多个相同的条目AppId
。现在我想要做的是得到Top 1
Comment
每个AppId
订购TimeStamp
说明。按功能分组与SQL 1中的顶部1
我已经试过类似
SELECT TOP 1 Comment, AppId FROM comments GROUP BY AppId
但这并不似乎工作,因为我得到一个错误
Column 'comments.Comment' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
可有人请指出我如何得到正确的方向这工作
谢谢