QUESTION E

0

Please login or register to vote for this query.

(click on this box to dismiss)

Movies and TV Meta

Q&A about the site for movie and tv enthusiasts

SELECT pt.OwnerDisplayName
		,AVG(pt.Score) as Avg_Score 
FROM (SELECT *
		FROM(
			SELECT p.OwnerUserId
				  ,p.OwnerDisplayName
				  ,p.Title
				  ,ROW_NUMBER() OVER(PARTITION BY p.OwnerUserId ORDER BY p.Id) as row_num
			FROM Posts p
			--WHERE p.Title IS NULL
			) p 
            GROUP BY p.OwnerUserId
				  ,p.OwnerDisplayName
				  ,p.Title
                  ,p.row_num
			HAVING MAX(row_num) < 8
		)a LEFT JOIN Posts pt ON a.OwnerUserId = pt.OwnerUserId 
								AND a.OwnerDisplayName = pt.OwnerDisplayName
WHERE pt.Title IS NULL
GROUP BY pt.OwnerDisplayName
ORDER BY AVG(pt.Score) DESC

Enter Parameters

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