Here is the example:
column_names = session.query(tab.c.name).filter(tab.c.value==354) column_names = [column_name for (column_name,) in column_names] query=sess.query(func.max(tab.columns['name']),datab.columns['article_id']).group_by(*column_names).all() I get an error here: ProgrammingError: (ProgrammingError) syntax error at or near ".6" LINE 2: ... GROUP BY fde.ck1.LKUT.RAT-ES.vertic.6hpa.low.6hdfjks.rih On Aug 12, 7:14 pm, Michael Bayer <[email protected]> wrote: > can you please illustrate a simple SQL statement that illustrates what you > are trying to achieve ? > > On Aug 12, 2011, at 1:00 PM, Eduardo wrote: > > > Dear all, > > I am trying to limit group_by function only on the rows that satisfy > > certain query > > if I use group_by(table.c.something) this pertains to whole table. > > I tried to use elements of the tuple rendered as a result of a query > > as arguments (as it has been suggested on this forum) but it did not > > work. > > Is this possible at all? > > Thanks > > > -- > > You received this message because you are subscribed to the Google Groups > > "sqlalchemy" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]. > > For more options, visit this group > > athttp://groups.google.com/group/sqlalchemy?hl=en. > > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
