Usuários que mais respondem a própria pergunta

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow em Português

Perguntas e respostas para programadores profissionais e entusiastas

SELECT USERS.ID AS [User Link], USERS.ID AS IDUSUARIO, COUNT(QUESTION.OWNERUSERID) AS QUANTIDADE, SUM(QUESTION.SCORE) AS QUANTIDADE_VOTOS_NA_PERGUNTA, SUM(ANSWER.SCORE) AS QUANTIDADE_VOTOS_NA_RESPOSTA, (SUM(QUESTION.SCORE) + SUM(ANSWER.SCORE)) AS TOTAL, USERS.CREATIONDATE FROM POSTS AS QUESTION
INNER JOIN POSTS AS ANSWER ON ANSWER.PARENTID = QUESTION.ID
INNER JOIN USERS AS USERS ON USERS.ID = QUESTION.OWNERUSERID
WHERE QUESTION.OWNERUSERID = ANSWER.OWNERUSERID
GROUP BY USERS.ID, USERS.DISPLAYNAME, USERS.CREATIONDATE, QUESTION.OWNERUSERID
ORDER BY 3 DESC

Enter Parameters

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