In general:

db(your_condition).select(db.table_name.ALL, orderby=~db.table_name.logtime)

As for your_condition, Python's timedelta should be useful: 
http://docs.python.org/2/library/datetime.html#datetime.timedelta

On Tuesday, October 8, 2013 3:56:33 AM UTC+2, Dave S wrote:
>
> On Monday, October 7, 2013 6:44:44 PM UTC-7, Dave S wrote:
>>
>> I have figured out that I'm interested in queries like
>>
>>     results = db.executesql("SELECT * FROM logtable where logtime < 
>> date('now','-1 day') AND logtime > date('now','-2 days') ORDER BY logtime 
>> DESC") ;
>>
>>
>> How would I rewrite that as DAL query?
>>  
>>
>
> And if I were to stick with the executesql() phrase,  how would I get 
> colnames so I could plug this into an SQLTABLE?
>
> /dps
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to