Created
August 12, 2013 20:06
-
-
Save relrod/6214604 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select persons.nickname, count(assertions.*) as assertions from assertions join persons on assertions.person_id = persons.id group by persons.nickname order by assertions desc limit 10; |
I'm really not 100% on this one, but off the top of my head maybe something to this effect:
session.query(Person, func.count(Person.assertions)).join(Assertion).order_by(Person.assertions.desc()).limit(10).all()
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Desired outcome is this: