Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- named_scope :has_commissions, lambda { |amount| { :conditions => ["id IN (SELECT user_id FROM (SELECT user_id, SUM(amount) AS amount FROM commissions GROUP BY user_id HAVING amount > ?) AS a)", amount] } }
Add Comment
Please, Sign In to add comment