[BangPypers] convert a query to SQLAlchemy

Baiju M baiju.m.mail at gmail.com
Sun Jan 30 04:43:07 CET 2011


Can any one help me to convert this query to SQLAlchemy sytax ?

  select * from distributions inner join (select * from comments where
  comments.id in (select max(comments.id) as id from comments group by
  comments.distribution_id)) a on distributions.id = a.distribution_id
  order by a.datetime desc

The schema is here:
May be the query can be simplified.

Baiju M

More information about the BangPypers mailing list