我想这样做:
emails = [c.email for c in Client.objects.all().order_by('lastname', 'firstname')]
是否有更好的方法可以查询SELECT email from clients ORDER BY lastname, firstname
?
答案 0 :(得分:7)
Client.objects.order_by('lastname', 'firstname').values_list('email', flat=True)