DECLARE @UserId int = ##UserId## select distinct


Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

DECLARE @UserId int = ##UserId##

select distinct v2.postid as 'Own', p2.body as 'Own answer', p2.Score as 'Own score'
from votes v2
inner join posts p2 on
  and p2.score>0 
  and p2.CommunityOwnedDate is null 
  and p2.OwnerUserId=@UserId
  and exists (select * from votes v1 inner join posts p1 on
  where p1.ParentId=p2.ParentId)
--and p1.posttypeid=2 
--  and p1.OwnerUserId<>@UserId  -- redundant
--  and v1.UserId=@UserId
--  and v1.VoteTypeId=1)

Enter Parameters

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