Weighted Activity Gauge for Scifi

0

Please login or register to vote for this query.

(click on this box to dismiss)

Lifehacks

Q&A for people looking to bypass life's everyday problems with simple tricks

SELECT 
  pt.Name as [PostType], 
  p.Id as [Post Link],
  p.CreationDate,
  p.Score,
  p.ViewCount,
  3 - p.PostTypeId + 
  -- 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 PostTags ptag
ON p.Id = ptag.PostId
JOIN Tags t
ON t.Id = ptag.TagId AND 
  t.TagName like '%comic%'
LEFT JOIN Posts p2
ON p.ParentId = p2.Id
WHERE 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##)
  or 
  p2.CreationDate BETWEEN convert(Date, ##StartDate:string##) and convert(Date, ##EndDate:string##))

Enter Parameters

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