High-Scoring Questions by Author Rep (Tutorial)

0

Please login or register to vote for this query.

(click on this box to dismiss)

Lifehacks

Q&A for people looking to bypass life's everyday problems with simple tricks

-- Show high-scoring questions and who wrote them.

-- The JOIN specifies the matching value (owner ID on a post = user ID).
-- This is how SQL connects entries in multiple tables.

-- With the addition of JOIN we now need to say which table each column
-- comes from in the SELECT statement; note the prefixes.

SELECT p.Title, p.Id, p.Score, p.ViewCount, u.DisplayName
FROM Posts p
JOIN Users u ON p.OwnerUserId = u.Id

WHERE p.PostTypeId = 1
AND p.Score >= 25

ORDER BY u.Reputation

Enter Parameters

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