Q&A for people looking to bypass life's everyday problems with simple tricks
SELECT DISTINCT pt.Name as PostType, p.Id as [Post Link], p.CreationDate, p.Score, isnull(p.ViewCount, p2.ViewCount) as [View Count], 3 - p.PostTypeId as Weight --+ -- Comment out the case if answers should have weight 1, -- regardless of if they are the accepted answer. -- CASE -- WHEN p2.AcceptedAnswerId = p.Id -- THEN 2 -- ELSE 0 -- END AS Weight FROM Posts p LEFT JOIN PostTypes pt ON p.PostTypeId = pt.Id LEFT JOIN Posts p2 ON p.ParentId = p2.Id JOIN PostTags ptag ON p.Id = ptag.PostId OR p2.Id = ptag.PostId JOIN Tags t ON t.Id = ptag.TagId WHERE t.TagName in ('comics','marvel-comics','dc-comics') AND p.OwnerUserId = (SELECT TOP 1 Id FROM Users WHERE DisplayName = ##DisplayName:string##) AND p.CreationDate BETWEEN convert(Date, ##StartDate:string##) and convert(Date, ##EndDate:string##)