Wow, my above example sucked. Here's something close to what I'm actually using:
qs = ... qunion = qs[0].union_all(*qs[1:]).subquery() joined = session.query( KnownComponents.name, qunion, func.group_concat(qunion.c.status.op('order by')(qunion.c.stop)) ). \ join(qunion).filter (KnownComponents.id==qunion.c.known_components_id) joined = joined.group_by( KnownComponents.name, KnownComponents.version, qunion.c.serial, qunion.c.dependent_version, qunion.c.compile_type ) rows = joined.all() --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---