Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Django merge duplicate rows

https://mefiz.com/  # For Developer

# Django merge duplicate rows
from django.db.models import Sum

YourModel.objects.values('name', 'user_id').annotate(total=Sum('amount')).values('name', 'user_id', 'total')
 
PREVIOUS NEXT
Tagged: #Django #merge #duplicate #rows
ADD COMMENT
Topic
Name
9+1 =