Probably the most comfortable way to do it is to use *executesql:*
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#executesql
*
*
On Monday, July 29, 2013 12:00:20 PM UTC+2, Denis Rykov wrote:
>
> Please help me to write the following SQL query using DAL:
>
> SELECT indicator.*, v.date, v.value FROM indicator
> LEFT JOIN (
>     SELECT value.value, _.indicator, date
>         FROM (SELECT indicator, min(client_date) AS "date" FROM value 
> WHERE created_by = 1 GROUP BY indicator) _
>         LEFT JOIN value ON _.indicator = value.indicator and _.date = 
> value.client_date
> ) v
> ON indicator.id = v.indicator
> WHERE indicator.checked = 'T'
>

-- 

--- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to