Highcharts

0

Please login or register to vote for this query.

(click on this box to dismiss)

Code Review

Q&A for peer programmer code reviews

SELECT 
    p.Id AS [Post ID], 
    p.PostTypeId,  -- Type of post (1 = Question, 2 = Answer)
    p.ParentId,    -- If it's an answer, the parent question's ID
    p.Title, 
    p.Body,        -- Content of the post
    p.Score, 
    p.CreationDate, 
    p.ViewCount, 
    p.AnswerCount, 
    p.CommentCount, 
    p.OwnerUserId, -- User who posted
    u.DisplayName, -- Username of the post owner
    u.Reputation,  -- Reputation of the user
    a.AcceptedAnswerId, -- If the post is a question, the accepted answer ID
    a.AnswerCount AS TotalAnswers, -- Total number of answers for the question
    t.TagName      -- Tags associated with the post
FROM 
    Posts p
JOIN 
    PostTags pt ON p.Id = pt.PostId
JOIN 
    Tags t ON pt.TagId = t.Id
LEFT JOIN 
    Users u ON p.OwnerUserId = u.Id
LEFT JOIN 
    Posts a ON p.Id = a.ParentId AND p.PostTypeId = 1 -- Join for answers, where parent is a question
WHERE 
    t.TagName = 'highcharts'
ORDER BY 
    p.CreationDate DESC

Enter Parameters

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