Displaying 1 result from an estimated 1 matches for "loyalty_id".
Did you mean:
locality_id
2011 Dec 27
1
sub query issue with active record.
i can manage the MySQL queries into active record.but in some cases
basically with sub-queries.i didn''t get the correct output.
here when i trying to change the MySQL queries into active-record.
*MySQL Query*
*select count(*) from ( SELECT transactions.loyalty_id FROM transactions
JOIN loyalties ON (transactions.loyalty_id = loyalties.id) where
loyalties.created_at > ''2011-11-02'' GROUP BY transactions.loyalty_id HAVING
COUNT(*)>1 ) as t*
Here just i tried to convert into corresponding active record queries. But
i didn''t...