项目基础信息合同面积取值优化

This commit is contained in:
yangkunan 2024-09-06 10:44:20 +08:00
parent c79c0ed6e6
commit dd5d92bb66

View File

@ -1,3 +1,8 @@
-- *****************************
-- 修改人: 杨坤安
-- 修改日期: 2024-09-06
-- 修改内容: 一个项目接管面积会有多个,先累加再关联
-- *****************************
select
b.CommId
, case when b.CommKind = '0001' then '商住'
@ -90,8 +95,23 @@ from (
, sum(TakeOverArea) TakeOverArea
, sum(ContractArea) ContractArea
, sum(ManageContractArea) ManageContractArea
from (select * from ods_erp_tb_hspr_projecttakeoverinformation_d where IsDelete = 0) a
left join (select TakeOverArea, ParentId from ods_erp_tb_hspr_projecttakeoverdetail_d WHERE IsDelete = 0) b
from
(
select
*
from ods_erp_tb_hspr_projecttakeoverinformation_d
where IsDelete = 0
) a
left join
(
select
ParentId
,SUM(TakeOverArea) AS TakeOverArea
from ods_erp_tb_hspr_projecttakeoverdetail_d
WHERE IsDelete = 0
group by
ParentId
) b
on a.id = b.ParentId
right join (select * from ods_erp_tb_hspr_projectbasicinfomation_d where IsDelete = 0) c
on a.ParentId = c.id