Here is the query I am trying to run:
SELECT TOP 5 PageComment.ID
FROM PageComment
WHERE PageComment.ParentID IN (SELECT ID FROM ProjectPage)
GROUP BY PageComment.ParentID
What I want to get as a result, is one comment per project however, this query gives this error:
"[Microsoft][SQL Native Client][SQL Server] Column PageComment.ID is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause"
I understand what it is saying, but this query would work in MySQL, how would I achieve this in SQL Server?