Re: querying joined tables and sum all

2019-01-14 Thread genc
I've achieved this by: .where{ ( subscriptions[:expires_on] =~ nil ) | (subscriptions[:expires_on] <= Time.now.utc) }.sql On Monday, January 14, 2019 at 10:03:38 PM UTC+3, genc wrote: > > Hi Jeremy, > > Sorry for previous question thread. I deleted it to not confusing. > > This is what I am

querying joined tables and sum all

2019-01-14 Thread genc
Hi Jeremy, Sorry for previous question thread. I deleted it to not confusing. This is what I am trying to do: 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