Hi Simon, On Friday, December 23, 2016 at 3:27:46 PM UTC+1, charettes wrote: > > users = User.objects.values(name=F('username')) > groups = Group.objects.values('name') > > results = users.union(groups).distinct().order_by('name')[:10] >
That does indeed work already, but it would be nice if it worked without .values so you can get out model objects again. Think of a union query giving you users which signed up in 2014 or 2016, surely one can easily do that via OR, but if I can get order_by to either return column numbers or realias every field from it's name to it's unqualified name (like you suggested with values, but internally in Query), that would be a massive win. Cheers, Florian -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at https://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/b0c8b6aa-29c6-4d8d-baf1-2068a183a313%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.