Q&A about the site for Drupal developers and administrators
declare @UserId int = ##UserId## select Id as [Post Link] from Posts question where exists(select * from Votes vote where vote.UserId = @UserId and vote.PostId = question.Id and VoteTypeId = 5) --Favourite and exists(select * from Posts answer where answer.OwnerUserId = @UserId and answer.ParentId = question.Id and PostTypeId = 2) --Answer