Skip to content

Instantly share code, notes, and snippets.

@Glorfindel83
Created December 2, 2019 07:52
Show Gist options
  • Save Glorfindel83/91b9346b33ec89f2ec0544cba8069e06 to your computer and use it in GitHub Desktop.
Save Glorfindel83/91b9346b33ec89f2ec0544cba8069e06 to your computer and use it in GitHub Desktop.
select top 20 p.id as [Post Link], p.score, p.viewcount, p.answercount, p.tags,
u.reputation, u.id as [User Link]
from posts p
inner join users u on p.owneruserid = u.id
inner join posts x on x.owneruserid = u.id
where u.reputation >= 1000
and p.tags like '%python%'
group by p.id, p.score, p.viewcount, p.answercount, p.tags, p.creationdate, u.reputation, u.id
having sum(case when x.posttypeid = 1 then 1 else 0 end)
< sum(case when x.posttypeid = 2 then 1 else 0 end)
order by p.creationdate desc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment