SELECT TOP 5000 'http://stackoverflow.com/users/' + CAST...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Christianity

Q&A for committed Christians, experts in Christianity and those interested in learning more

SELECT 	TOP 5000 
		'http://stackoverflow.com/users/' + CAST(p.OwnerUserId AS VARCHAR(10)) AS OwnerLink,
		'http://stackoverflow.com/questions/' + CAST(p.ID AS VARCHAR(10)) AS QuestionLink,
		p.Score,
		p.ViewCount,
		p.FavoriteCount,
		p.Title,
		LEN(p.Title) AS TitleLength,
		LEN(p.Body) AS BodyLength,
		p.Tags,
		p.CreationDate
FROM 	Posts AS p
		INNER JOIN Posts As pa
			ON	pa.PostTypeId = 2						-- <<== Answer
				AND p.Id = pa.ParentID
				AND	p.OwnerUserId <> pa.OwnerUserId 	-- <<== not come on the same poster
				AND	p.AcceptedAnswerId = pa.Id
WHERE 	p.PostTypeId = 1 								-- <<== Questions
		AND p.CommunityOwnedDate IS NULL  				-- <<== not WIKI
		AND DATEDIFF(second, p.CreationDate, pa.CreationDate) >= 0
ORDER 	BY 	DATEDIFF(second, p.CreationDate, pa.CreationDate), 
			pa.Score DESC

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results