Scratchpad2

0

Please login or register to vote for this query.

(click on this box to dismiss)

Physics

Q&A for active researchers, academics and students of physics

DECLARE @UserId int = ##UserId##

select b.Id, max(a.Id) 
from Posts a inner join Posts b on a.ParentId = b.Id
             inner join Posts c on c.ParentId = b.Id
where a.PostTypeId = 2
and a.OwnerUserId = @UserId
and b.PostTypeId = 1
and b.AcceptedAnswerId is NULL
and c.PostTypeId = 2
and c.OwnerUserId <> @UserId
and a.Score > 0
group by b.Id
having max(a.Score) >= max(c.Score);

Enter Parameters

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