Created
June 16, 2017 13:47
-
-
Save martinsam/ab4e083093f7b8caba2bc681f111a3d0 to your computer and use it in GitHub Desktop.
Compter le nombre de doublons présents dans une table (ORM Django)
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
from django.db.models import Count | |
ExamConvocation.objects.values('exam_id', 'applicant_id').annotate(Count('id')).order_by().filter(id__count__gt=1) | |
>> [{'exam_id': 10, 'applicant_id': 80, 'id__count': 2}, {'exam_id': 37, 'applicant_id': 364, 'id__count': 2}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment