[sqlalchemy] Re: changing a max subquery into sqlalchemy query

2009-04-24 Thread Michael Bayer
s = select ([func .max (history .c .history_id ).label('history_id')]).group_by(history.c.many_id).alias('max_history') sess.query(History).join((s, and_(History.history_id==s.c.history_id, History.action_id.in_([foo, bar] examples of using query.join() are illustrated at

[sqlalchemy] Re: changing a max subquery into sqlalchemy query

2009-04-24 Thread fintan
Thanks Michael, your a star. I'll read up over the weekend. fintan. 2009/4/24 Michael Bayer mike...@zzzcomputing.com s = select ([func .max (history .c .history_id ).label('history_id')]).group_by(history.c.many_id).alias('max_history') sess.query(History).join((s,