How can I select multiple columns from a Django model? -
at moment have query selects distinct values model:
meeting.objects.values('club').distinct()
in addition 'club' field, wish select 'time' field. in other words wish select distinct values of 'club' field , associated 'time' field. example for:
club,time abc1,10:35 abc2,10:45 abc2,10:51 abc3,11:42
i want:
abc1,10:35 abc2,10:45 abc3,11:42
what syntax this?
this possible, if database backend postgresql. here how can done:
meeting.objects.order_by('club', 'time').values('club', 'time').distinct('club')
Comments
Post a Comment