Users with answers having a score of X or more.

0

Please login or register to vote for this query.

(click on this box to dismiss)

Physical Fitness Meta

Q&A about the site for physical fitness professionals, athletes, trainers, and those providing health-related needs

declare @minScore numeric = ##MinimumScore##

DECLARE @endDate date
SELECT @endDate = max(CreationDate) from Posts

SELECT
    tmp.[User Link], 
    DATEDIFF(DAY,tmp.startDate,@endDate) as [Account Age],
    COUNT(*) as Answers,
    SUM(tmp.score) as [Total Score]
FROM
    (SELECT
        p.Score AS score,
        p.OwnerUserId AS "User Link",
        u.CreationDate AS startDate
    FROM
        Posts p,
        Users u
    WHERE
        p.Score >= @minScore and
        p.posttypeid = 2 and
        p.OwnerUserId is not null and
        p.OwnerUserId = u.Id
    GROUP BY
        p.OwnerUserId,
        p.Score,
        u.CreationDate
    ) AS tmp
    
GROUP BY
    tmp.[User Link],
    tmp.startDate
ORDER BY Answers DESC

Enter Parameters

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