Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Parent.connection.select_values("SELECT id FROM parents").map {|parent_id| Child.connection.select_value("SELECT date FROM children WHERE parent_id = #{parent_id} ORDER BY date DESC LIMIT 1").to_date }.min
Add Comment
Please, Sign In to add comment