26 lines
1.0 KiB
MySQL
26 lines
1.0 KiB
MySQL
|
SELECT
|
||
|
c.CommId,
|
||
|
c.ManageKind,
|
||
|
case when c.ManageKind = '0001' then '项目内盘'
|
||
|
when c.ManageKind = '0002' then '项目外盘(全委)'
|
||
|
when c.ManageKind = '0003' then '项目外盘(合资)'
|
||
|
when c.ManageKind = '0004' then '案场内盘'
|
||
|
when c.ManageKind = '0005' then '案场外盘(全委)'
|
||
|
when c.ManageKind = '0006' then '案场外盘(合资)'
|
||
|
end ManageKindName,
|
||
|
I.ContractArea,
|
||
|
I.ManageContractArea,
|
||
|
COALESCE((
|
||
|
SELECT SUM(COALESCE(TakeOverArea, 0))
|
||
|
FROM ods_erp_tb_hspr_projecttakeoverdetail_d
|
||
|
WHERE IsDelete = 0 AND ParentId = I.ID
|
||
|
), 0) AS TakeOverArea
|
||
|
, right(b.StateName,4) StateName
|
||
|
, b.Province
|
||
|
, b.City
|
||
|
, b.County
|
||
|
FROM ods_erp_tb_hspr_projecttakeoverinformation_d AS I
|
||
|
right join ods_erp_tb_hspr_projectbasicinfomation_d b
|
||
|
on i.ParentId = b.id
|
||
|
right join ods_erp_tb_hspr_community_d c
|
||
|
on b.CommId = c.CommId
|