Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- WITH post_count AS
- (SELECT
- p.user_id AS user_id,
- u.display_name as name,
- COUNT(p.id )AS post_count
- FROM stackoverflow.users AS u
- INNER JOIN stackoverflow.posts AS p ON p.user_id = u.id
- INNER JOIN stackoverflow.post_types AS pt ON pt.id = p.post_type_id
- WHERE pt.type = 'Answer' AND DATE_TRUNC('day', p.creation_date) <= DATE_TRUNC('day', u.creation_date) + INTERVAL '1 month'
- GROUP BY user_id, u.display_name
- HAVING COUNT(p.id) > 100
- ORDER BY u.display_name)
- SELECT pc.name, COUNT(pc.user_id) AS ucount
- FROM post_count as pc
- GROUP BY pc.name
- ORDER BY pc.name
Advertisement
Add Comment
Please, Sign In to add comment