On Sat, Oct 11, 2008 at 7:41 PM, Jonathan Ellis <[EMAIL PROTECTED]> wrote:
> I want to do something like this:
>
> select ticket.*, (select count(*) from ticket_changes where
> ticket_changes.ticket = ticket.id) as count
> from ticket

Justin solved this in IRC.  The answer is,

>>> subquery = select([func.count('*')], from_obj=ticket_changes)
>>> session.query(Ticket, subquery.as_scalar()).first()

-Jonathan

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to