Hi Jeremy, This is my SQL query:
select sum(sp.storage_size) + sum(bp.storage_size) as storage_size from subscriptions s left join subscription_packages sp on s.subscription_package_id = sp.id left join bounty_packages bp on s.bounty_package_id = bp.id where s.user_id = 4; However, second left join is always broken: Subscription.select{ sum(Sequel[:'bounty_packages.storage_size']) + sum( Sequel[:'subscription_packages.storage_size']) } .left_join(:subscription_packages, id: :subscription_package_id) .left_join(:bounty_packages, id: :bounty_package_id) # this join trying to join previous join (subscription_packages) not the main 'subscriptions' table .where(user: user) Is there a wiser way to accomplish my query with Sequel? Thanks, Genc. -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to sequel-talk+unsubscr...@googlegroups.com. To post to this group, send email to sequel-talk@googlegroups.com. Visit this group at https://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.