Q&A about the site for serious players and enthusiasts of poker
SELECT PostsWithDeleted.CreationDate as 'Question Date', PostsWithDeleted.Id AS [Post Link], 'site://users/' + CONVERT(VARCHAR(15),Users.Id) + '|' + Users.DisplayName AS 'Question Poster', 'site://users/' + CONVERT(VARCHAR(15),PostNotices.OwnerUserId) + '|' + (CASE WHEN PostUser.DisplayName IS NULL THEN '[deleted:'+CONVERT(VARCHAR(15),PostNotices.OwnerUserId)+']' ELSE PostUser.DisplayName END ) AS 'Bounty Poster' FROM PostsWithDeleted INNER JOIN Users ON PostsWithDeleted.OwnerUserId = Users.Id INNER JOIN PostNotices ON PostsWithDeleted.Id = PostNotices.PostId INNER JOIN PostNoticeTypes ON PostNotices.PostNoticeTypeId = PostNoticeTypes.Id LEFT JOIN Users AS PostUser ON PostNotices.OwnerUserId = PostUser.Id WHERE PostsWithDeleted.PostTypeId = 1 AND PostNoticeTypes.ClassId = 2 AND Users.Id <> PostNotices.OwnerUserId AND Users.AccountId IN (##UserIds##) ORDER BY PostsWithDeleted.CreationDate DESC