search for: favourite_peopl

Displaying 1 result from an estimated 1 matches for "favourite_peopl".

Did you mean: favourite_people
2006 Oct 02
2
when to use find_by_sql
I have a bunch of queries to compute some counters, like find_by_sql(<<-SQL SELECT p.*, c.nfavourites FROM people p, ( SELECT fp.person_id, COUNT(fp.user_id) as nfavourites FROM favourite_people fp, users u WHERE fp.user_id = u.id AND u.cluster = ''#{in_cluster_of_user.cluster}'' GROUP BY fp.person_id ) as c WHERE p.user_id IS NOT NULL AND p.id = c.person_id ORDER BY c.nfavourites DESC LIMIT #{limit} SQL ) They do...