Post comparison for tag


Please login or register to vote for this query.

(click on this box to dismiss)

Compare your posts to someone else (wip 'for a set of tags')


Q&A for professionals and students of engineering

declare @UserId1 int = ##UserId1##
declare @UserId2 int = ##UserId2##
declare @TagOfChoice nchar(25) = ##TagOfChoice##;

with fights as (
  select myAnswer.ParentId as Question,
   myAnswer.Score as MyScore,
   theirAnswer.Score as TheirScore
  from Posts as myAnswer
  inner join Posts as TheirAnswer
  on TheirAnswer.OwnerUserId = @UserId2
  and myAnswer.ParentId = TheirAnswer.ParentId
  where myAnswer.ownerUserId = @UserId1 
  and myAnswer.postTypeId = 2 --and TagName like @TagOfChoice

   when myScore > TheirScore then 'You win'
   when myScore < TheirScore then 'They win'
   else 'Tie'
  end as 'Winner',
  Question as [Post Link],
  myScore as 'My score',
  TheirScore as 'Their score'
from fights;

Enter Parameters

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