Kei
Kei

Reputation: 1616

Google AppEngine Query Sort

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

Answers (2)

Alex Bolotov
Alex Bolotov

Reputation: 8971

Have you tried:

Person.all().order("lastname").order("firstname")

Upvotes: 2

Aviad Ben Dov
Aviad Ben Dov

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

Related Questions