Top questions asked greater than N weeks ago, by tag by view and score

0

Please login or register to vote for this query.

(click on this box to dismiss)

Music Fans Meta

Q&A about the site for music historians, critics, and fans

SELECT * FROM
(
  SELECT TOP 500
    'By View' AS Label,
    OwnerUserId AS [User Link],
    po.Id AS [Post Link],
    Score, 
    ViewCount
  FROM Posts po
  JOIN PostTags pt
  ON po.Id = pt.PostId
  JOIN Tags t
  ON pt.TagId = t.Id
  WHERE t.TagName = ##Tag:string?java## AND
    DATEDIFF(WEEK, po.CreationDate, GetDate()) > ##WeeksOld?100## 
    AND PostTypeId = 1 AND ClosedDate IS NULL
  ORDER BY ViewCount DESC
) Q
UNION ALL
SELECT * FROM (
  SELECT TOP 0
    'By Score' AS Label,
    OwnerUserId AS [User Link],
    po.Id AS [Post Link],
    Score, 
    ViewCount
  FROM Posts po
  JOIN PostTags pt
  ON po.Id = pt.PostId
  JOIN Tags t
  ON pt.TagId = t.Id
  WHERE t.TagName = ##Tag:string?java## AND
    DATEDIFF(WEEK, po.CreationDate, GetDate()) > ##WeeksOld?100##
    AND PostTypeId = 1 AND ClosedDate IS NULL
  ORDER BY Score DESC
) R

Enter Parameters

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