SELECT DISTINCT TOP 10 'https://stackoverflow.com/questio...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

SELECT DISTINCT TOP 10
    'https://stackoverflow.com/questions/' + CONVERT(VARCHAR, q.Id) as url,
    (q.ViewCount / -DATEDIFF(DAY, GETDATE(), q.CreationDate)) AS ave_views_per_day,
    q.Body as QUESTION,
    q.Id,
    q.Title,
    FIRST_VALUE(a.Body) OVER (PARTITION BY q.id ORDER BY a.Score DESC) AS HighestScoringAnswer
    
FROM Posts q
LEFT JOIN Posts a ON q.id = a.ParentId

WHERE q.PostTypeId = 1 
      AND q.Tags LIKE '%%##tag##%%'
      AND q.ViewCount > 10000
      
ORDER BY ave_views_per_day DESC;

Enter Parameters

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