Q&A for people using the vi and Vim families of text editors
--Up vote 100 answers on questions where an answer of yours has a positive score. - select parentid as qID, id as aID, owneruserid, creationdate, score, RANK ( ) OVER ( partition by parentid order by score desc ) as Rank into #temp from posts where parentid in (select distinct parentid from posts where owneruserid=##UserID## and posttypeid=2 and closeddate is null and score>0) and posttypeid=2 and closeddate is null and score>0 order by parentid, case when owneruserid=##UserID## then 0 else 1 end, score desc select qID, aID as [Post Link], a.owneruserid as [User Link], a.creationdate, a.score, a.rank, q.answercount, q.viewcount from #temp a left outer join posts q on a.qID = q.ID where a.rank=1 and a.owneruserid<>##UserID##