I have the following statement :
SELECT name, id, division, value,
FROM (
SELECT name, id, division,value, max(value) over
(partition by division) as max_val
FROM tab1
)
WHERE value = max_val
I try to turn this sql statement into a Query object
I tried this
sqlquery=session.query(sometab)
sqlquery.statement= "SQL QUERY GIVEN ABOVE"
but it does not work because statement cannot be set directly.
What is get-around for this?
Can this statement be written as a subquery? If yes, how? I saw
several example of subqueries on the internet but none of these seem
to be suitable for this statement.
Thanking in advance
Eddie
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.