Q&A for SharePoint enthusiasts
select * from ( select postid, id, creationdate, row_number() over ( partition by postid order by creationDate desc) as _rn from comments ) t1 WHERe t1._rn = 1;