Bj wrote:
>
>
> not sure if the example was clear enough.
> What I'm trying to do is to convert the following select to a mapped-
> class:
>
> select id, usr_id, rating,
>        ( select COUNT(*) from ratings as r where r.id = ratings.id ),
>        ( select AVG(r.rating) from ratings as r where r.id =
> ratings.id)
>        from ratings

you probably want to alias() the inner tables since they are
self-referring to the parent



>
>
>
>
> >
>


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

Reply via email to