On 10 Apr, 15:43, Mike Conley <mconl...@gmail.com> wrote:
> Try this, has one nested query
> sub = session.query(C.id.label('c_id'),
>         C.d_id.label('d_id'),
>         func.max(C.value).label('c_maxvalue')
>         ).group_by(C.d_id).subquery()

I tried something like that earlier, but postgreSQL complained that
> column "c.id" must appear in the GROUP BY clause or be used in an aggregate 
> function
I think this is because given N rows with the same d_id, the DBMS
can't figure out which C.id to return, even if I'd like it to choose
the one corresponding to the current maxvalue :/
Or maybe I'm missing something?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to