Most Viewed Questions Answered

1

Please login or register to vote for this query.

(click on this box to dismiss)

Motor Vehicle Maintenance and Repair Meta

Q&A about the site for mechanics and DIY enthusiast owners of cars, trucks, and motorcycles

DECLARE @UserId INT = ##UserId:INT##
-- After editing, remove ?9814069
-- How to return Yes/No if AID=MID?

SELECT 

    TOP ##TopCount:INT?100## -- optional

-- Columns
    q.Id AS [Post Link],
    qu.Id AS [User Link],
    q.CreationDate AS Created,
    q.ViewCount AS Views,
    q.AnswerCount AS AC,
    q.AcceptedAnswerId AS AID,
    a.Id AS MID,
    q.Score AS QS,
    a.Score AS MS,
    q.CommentCount AS QC,
    a.CommentCount AS MC,
    q.Tags

FROM Posts a -- my answers
JOIN Posts q ON a.ParentID=q.Id -- my answers' questions
JOIN Users qu ON q.OwnerUserId=qu.Id -- questions' users

WHERE a.OwnerUserId=@UserId
-- Ideas:
AND q.CreationDate >= '2024-01-01' -- after date incl.
AND q.AcceptedAnswerId=a.Id -- my answer is accepted

ORDER BY Views DESC, Created DESC, MS DESC, QS DESC

Enter Parameters

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