[Answer]-How to do aggregation with filter in django

1👍

You need to use the queryset’s aggregate method and the models aggregation functions.

from django.db.models import Min
models.ServerName.objects.filter(server_id=ServerName.id).aggregate(Min('time'))

See https://docs.djangoproject.com/en/1.8/topics/db/aggregation/ for details.

Leave a comment