orderby ascending or descending

139 views
Skip to first unread message

DenesL

unread,
Feb 15, 2008, 9:28:37 AM2/15/08
to web2py Web Framework
I need to obtain a SQLRows object sorted in descending order, is that
option missing?.

If yes, this should be an easy mod since it only requires to include
the optional ASC or DESC spec at the end of the ORDER BY in the SQL
statement.

mdipierro

unread,
Feb 15, 2008, 9:30:04 AM2/15/08
to web2py Web Framework
db().select(orderby=db.table.field) ORDERS ASCENDING
db().select(orderby=~db.table.field) ORDERS DESCENDING
db().select(orderby=~db.table.field|db.table.otherfield)
ORDERS DESCVENDING in field ASCENDING in otherfield

You can also do

db().select(orderby="...")

WHERE "..." is an SQL order by option.

DenesL

unread,
Feb 15, 2008, 9:33:31 AM2/15/08
to web2py Web Framework
copy/paste... LOL...
What a coincidence!
I posted my question at exactly the same time you were answering it.

DenesL

unread,
Feb 15, 2008, 9:49:02 AM2/15/08
to web2py Web Framework
Where in the source do you accomplish that?.
I was looking in the gluon.sql module but I can't see it.

mdipierro

unread,
Feb 15, 2008, 9:51:20 AM2/15/08
to web2py Web Framework
yes, I can barely keep up...

Mind that I may be slow or down in the next 2 days....

DenesL

unread,
Feb 15, 2008, 10:00:46 AM2/15/08
to web2py Web Framework
IMHO you are doing and excellent job.
Thank you for your efforts.

Massimo Di Pierro

unread,
Feb 15, 2008, 11:32:56 AM2/15/08
to web...@googlegroups.com
It is in there: in SQLSet methods select() and SQLXorable

btw, you can also do

orderby=db.table.field.upper()

and

orderby=db.table.datefield.month()

and combinations thereof.

Massimo

Massimo Di Pierro

unread,
Feb 15, 2008, 11:33:12 AM2/15/08
to web...@googlegroups.com
thanks.
Reply all
Reply to author
Forward
0 new messages