[Answer]-Select from table with grouping by field and selecting max datetime with Django ORM

1👍

I think it should be like this

AdvertShowEvent.objects.filter(user=user).values('advertis*m*nt').annotate(Max(‌​'datetime'), id=MAX('id')).values_list('id', flat=True)

Leave a comment