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)
).filter_by(rating_key=1,user_id=1).first()
desired result:
r.rating_key = 1
r_user_id = 1
r.rating = 5
r.average = 4.5 #averate all users for rating_key 1
r.count = 2 #rating count (users) for rating_key 1
thanks Bj
--~--~-~--~~~---~--~~
You received this message