标签:
--合同执行度(累计已审批/合同汇总金额)
--投资进度(合同汇总总额/批准概算投资额)
select a.*,cast(round((ljysp/( case when xmze=0 then 1 else xmze end))*100,2) as numeric(5,2)) as htzxd
,cast(round((( case when AP =0 then 0 else xmze/AP end))*100,2) as numeric(5,2)) as tzjd
,ROW_NUMBER() OVER (ORDER BY InfoId desc) AS RowIndex
from (
select
*,ISNULL((select Sum(HeaderMoney) from AgileCorp_Fund_PayApply where ProjectCode=Fund_vProject.ProjectCode),0)as ljysp,
ISNULL(( select sum((case when InitFactInputPrice>0 then InitFactInputPrice else ContractPrice end)) from AgileCorp_Fund_Contract where ProjectCode=Fund_vProject.ProjectCode),0)
as xmze
from Fund_vProject
)a
标签:
原文地址:http://www.cnblogs.com/howie/p/5048727.html