Reputation: 1616
How can I sort the results of Query using more than 1 property?
For example, I want to sort my Query results by 'lastname' and sort by 'firstname' in each group of 'lastname'.
Upvotes: 3
Views: 1046
Reputation: 8971
Have you tried:
Person.all().order("lastname").order("firstname")
Upvotes: 2
Reputation: 6409
Just use two orders separated by comma, e.g.:
SELECT * FROM person ORDER BY lastname, firstname
See here for more details.
Upvotes: 1