declare @UserId int = ##UserId##; declare @OtherUserId i...


Please login or register to vote for this query.

(click on this box to dismiss)

The Workplace Meta

Q&A about the site for members of the workforce navigating the professional setting

-- Enter Query Title
-- Enter Query Description

declare @UserId int = ##UserId##;
declare @OtherUserId int = ##OtherUserId##;

with fights as (
  select myAnswer.ParentId as Question,
   myAnswer.Score as MyScore,
   OtherUserAnswer.Score as OtherUserScore
  from Posts as myAnswer
  inner join Posts as OtherUserAnswer
   on OtherUserAnswer.OwnerUserId = @OtherUserId and myAnswer.ParentId = OtherUserAnswer.ParentId
  where myAnswer.ownerUserId = @UserId and myAnswer.postTypeId = 2

   when myScore > OtherUserScore then 'You win'
   when myScore < OtherUserScore then 'You lose'
   else 'Tie'
  end as 'Winner',
  Question as [Post Link],
  myScore as 'My score',
  OtherUserScore as "Jon's score"
from fights;

Enter Parameters

Switch to main site
loading Hold tight while we fetch your results