Displaying 1 result from an estimated 1 matches for "nfavourites".
Did you mean:
favourites
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...