Saya pikir Anda tidak dapat melakukan semuanya sekaligus karena Anda ingin mengelompokkan/menjumlahkan item dari tabel yang berbeda secara bersamaan. Coba ini:
select unit, name, stays, days, total_price, charges, mgmt_fee,
(total_price*.01*mgmt_fee) AS management,
(total_price-(total_price*.01*mgmt_fee)-charges) AS bal
from (
select
x.unit,
name,
count(*) as stays,
sum(days) as days,
sum(total_price) as total_price,
charges,
mgmt_fee
from
(select
unit ,
datediff(depart,arrival) as days,
total_price
from
Reservations
) as x
join (
select unit, sum(amount) as charges
from Charges
group by unit
) as y
on x.unit = y.unit
join Unit as u
on u.id = x.unit
group by unit
) as inner_result
Tidak terlalu rapi atau elegan, tapi saya pikir itu berhasil. Perhatikan bahwa Anda harus berhati-hati jika ada> 1 baris dalam biaya per unit. Berikut adalah biola untuk menunjukkannya berjalan:http://sqlfiddle.com/#!2/f05ba/18