Some of the information here may be outdated, please check the book instead
[edit]

Given

 db=SQLDB(....)
 db.define_table('mytable',SQLField('myfield'),SQLField('datefield','date'))

You can order ascending:

 db().select(orderby=db.mytable.myfield)

Order descending:

 db().select(orderby=~db.mytable.myfield)

Combine ordering rules:

 db().select(orderby=~db.mytable.myfield|db.mytable.datefield)

You can also do

  db().select(orderby="mytable.myfield DESC")

where "..." is an SQL orderby option, and things like

  orderby=db.mytable.myfield.upper()
  orderby=db.mytable.datefield.month()

or combinations of any of the above.

© 2008-2010 by Massimo Di Pierro - All rights reserved - Powered by web2py - design derived from a theme by the earlybird
The content of this book is released under the Artistic License 2.0 - Modified content cannot be reproduced.