Top 50 C# questions

0

Please login or register to vote for this query.

(click on this box to dismiss)

Bicycles Meta

Q&A about the site for people who build and repair bicycles, people who train cycling, or commute on bicycles

DECLARE @Offset int = 0; 

WITH TopQuestions AS (
    SELECT
        p.Id AS QuestionId,
        p.Title AS QuestionTitle,
        p.Score AS QuestionScore
    FROM
        Posts p
    INNER JOIN PostTags pt ON pt.PostId = p.Id
    WHERE
        p.PostTypeId = 1 AND
        pt.TagId = 3
    ORDER BY
        p.Score DESC
    OFFSET @Offset ROWS
    FETCH NEXT 5000 ROWS ONLY
)

SELECT
    q.QuestionTitle AS Question,
    q.QuestionScore AS Ranking,
    a.Body AS Answer
FROM
    TopQuestions q
JOIN
    Posts a ON q.QuestionId = a.ParentId
WHERE
    a.PostTypeId = 2 AND
    a.Score = (
        SELECT MAX(b.Score)
        FROM Posts b
        WHERE b.ParentId = q.QuestionId
    )
ORDER BY
    q.QuestionScore DESC;

Enter Parameters

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