I think I got it: s = select([tags_table.c.tag_name, func.count(tags_table.c.tag_id).label('weight')], tags_table.c.tag_id==pages_tags_table.c.tag_id, group_by=[tags_table.c.tag_id], order_by=[f(order_by)])
where f is either asc or desc, and order_by is either 'weight' or tags_table.c.tag_name depending how I want it sorted. Now I only need to wrap this in a nice function. --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---