What questions does Jon Skeet have a higher/lower score on than me?
Q&A for people looking to bypass life's everyday problems with simple tricks
declare @UserId int = ##UserId##; with fights as ( select myAnswer.ParentId as Question, myAnswer.Score as MyScore, jonsAnswer.Score as JonsScore from Posts as myAnswer inner join Posts as jonsAnswer on jonsAnswer.OwnerUserId = 115145 and myAnswer.ParentId = jonsAnswer.ParentId where myAnswer.ownerUserId = 22656 and myAnswer.postTypeId = 2 ) select case when myScore > JonsScore then 'You win' when myScore < JonsScore then 'Mark wins' else 'Tie' end as 'Winner', Question as [Post Link], myScore as 'My score', jonsScore as "Mark's score" from fights;