leading-project/dw/dws/dws_innoveco_space_point_rent_d.sql
2024-07-21 22:06:45 +08:00

17 lines
470 B
SQL

select
b.organ_code
, b.organ_name
, b.comm_id
, b.comm_name
, round(sum(a.OutNum) / nullif(sum(a.OutMustNum),0),2) assess_rental_rate
, sum(a.OutNum) out_num
, sum(a.OutMustNum) out_must_num
from dwd_innoveco_space_point_rent_report_d a
left join dim_organ_mapping b
on a.CommID = b.comm_id
where b.comm_id is not null
group by
b.organ_code
, b.organ_name
, b.comm_id
, b.comm_name