sql - How to use 2 Sums in 1 select statement? -


i sums of 2 rows of 2 separate tables in 1 query. tried this:

select sum(items.price) [total items], sum(stores.cash) [total cash] items, stores 

however, query returns sum of price * number of stores , total cash in stores * number of items. went wrong?

use this

select sum(price) [total items]      , (select sum(cash) [total cash] stores) items 

Comments