Example aggregating subselect

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

select Id
,      (select count (*)
        from Posts
        where PostTypeId = 2
          and OwnerUserId = Users.Id) as AnswerCount
,      DisplayName
from Users
where CreationDate > DateAdd(mm, -1, CURRENT_TIMESTAMP)

Enter Parameters

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