User.objects.values("email").annotate(num_emails=Count("email")
).order_by("-num_emails").filter(
num_emails__count__gt=1):
Reference:
http://stackoverflow.com/questions/8989221/django-select-only-rows-with-duplicate-field-values
Wednesday, September 17, 2014
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment