Weighted Activity Gauge for Scifi

0

Please login or register to vote for this query.

(click on this box to dismiss)

Literature Meta

Q&A about the site for scholars and enthusiasts of literature

SELECT 
  p.Id,
  p2.AcceptedAnswerId,
  isnull(p2.Title, p.Title) AS Title, 
  pt.Name, 
  p.PostTypeId,
  3 - p.PostTypeId - 
    CASE
      WHEN p2.AcceptedAnswerId = p.Id 
      THEN 0
      ELSE 1
    END AS Weight
  --p2.AcceptedAnswerId
FROM Posts p
JOIN PostTypes pt
ON p.PostTypeId = pt.Id
LEFT JOIN Posts p2
ON p.Id = p2.AcceptedAnswerId
/*
JOIN (
  SELECT 1 AS PostTypeId, 'Question' AS WieghtType, 2 as WeightValue
  UNION ALL
  SELECT 2, 'Answer', 1
  UNION ALL
  SELECT 3, 'Accepted Answer', 3
  ) Weights
*/
WHERE p.OwnerUserId = 7816

Enter Parameters

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