And updated query to the query "Jon Skeet comparison" that allows for comparison against any user.
Q&A about the site for people looking to bypass life's everyday problems with simple tricks
declare @UserId int = ##UserId##; declare @OpponentUserId int = ##OpponentUserId##; with fights as ( select myAnswer.ParentId as Question, myAnswer.Score as MyScore, opponentAnswer.Score as OpponentScore from Posts as myAnswer inner join Posts as opponentAnswer on opponentAnswer.OwnerUserId = @OpponentUserId and myAnswer.ParentId = opponentAnswer.ParentId where myAnswer.ownerUserId = @UserId and myAnswer.postTypeId = 2 ) select case when myScore > OpponentScore then 'You win' when myScore < OpponentScore then 'You lose' else 'Tie' end as 'Winner', Question as [Post Link], myScore as 'My score', OpponentScore as "Opponent's score" from fights;