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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to