On Thu, Sep 3, 2009 at 8:05 AM, Noufal <nou...@gmail.com> wrote: > > > stmt = session.query(Order.table.c.client_id,func.max > (Order.table.c.date).label('latest_order')).group_by > (Order.table.c.date).subquery() > > I think your group_by needs to be Order.table.c.client_id to get latest order per client
-- Mike Conley --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---