user comparison

0

Please login or register to vote for this query.

(click on this box to dismiss)

What questions does Jon Skeet have a higher/lower score on than me?

Poker Meta

Q&A about the site for serious players and enthusiasts of poker

declare @User1Id int = ##User1Id##;
declare @User2Id int = ##User2Id##;

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 = @User1Id and myAnswer.ParentId = jonsAnswer.ParentId
  where myAnswer.ownerUserId = @User2Id and myAnswer.postTypeId = 2
)

select
  case
   when myScore > JonsScore then 'User 2 wins'
   when myScore < JonsScore then 'User 1 wins'
   else 'Tie'
  end as 'Winner',
  Question as [Post Link],
  myScore as 'User 2 score',
  jonsScore as "User 1 score"
from fights;

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results