首页 > 数据库技术 > 详细

sql子查询

时间:2015-12-15 16:48:47      阅读:324      评论:0      收藏:0      [点我收藏+]

--合同执行度(累计已审批/合同汇总金额)
--投资进度(合同汇总总额/批准概算投资额)
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

sql子查询

原文:http://www.cnblogs.com/howie/p/5048727.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!