Created
August 14, 2015 01:43
-
-
Save youqingkui/04bad8151e13640ea60c to your computer and use it in GitHub Desktop.
MySQL按照记录条数排序
This file contains 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 * , count(desire_id) AS num | |
# FROM desire_tran | |
# GROUP BY desire_id | |
# ORDER BY num DESC | |
q = q.filter(DesireInfo.desire_id == DesireTran.desire_id).filter(DesireTran.is_real == 1)\ | |
.group_by(DesireInfo.desire_id).distinct() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment