|
楼主 |
发表于 2017-7-11 14:44:07
|
显示全部楼层
这个简单的可以,复杂带嵌套的sql语句转换成KSQL就不行了,获取不出概念名, 我现在想做的功能就是 在grid展现的数据,能到处能传参,参数是在 是在 子查询中,能不能就自己写个action,然后还能够使用平台自带的excel导出啊?具体的sql 语句如下,as_date是要传的参数:
select newid() fid,left(right(fContractNo,9),4) + right(fContractNo,3) xh, fContractNo,fCustomName,fHireDate,fEndDate,fDuration,isnull(currentrent,0) currentrent,isnull(SumOverdueRent,0) SumOverdueRent,isnull(currentrent,0)+isnull(SumOverdueRent,0) total from (
select fContractNo,fCustomName,HX_ProjectApply.fHireDate,HX_ProjectApply.fEndDate,HX_ProjectApply.fDuration
,( select sum(fZLFSQ) from HX_YJXJL where left(convert(varchar(10),fZFSJ,120),7) = left(convert(varchar(10),:as_date,120),7) and fLXID =HX_ProjectApply.fID) currentrent ,
(select isnull(sum(SumOverdueRent),0) from (select (isnull(fZLFSQ,0) - isnull((select sum(fIncome) from FI_RentWriteOff where fXJLID = HX_YJXJL.fID ),0)) SumOverdueRent,fLXID from
HX_YJXJL where convert(char(10),fZFSJ,120) < convert(char(10),:as_date,120) ) a where fLXID = HX_ProjectApply.fID and SumOverdueRent >0 ) SumOverdueRent ,
(select sum(fIncome) from FI_RentWriteOff where fXJLID in (select fID from HX_YJXJL where fLXID = HX_ProjectApply.fID and left(convert(varchar(10),fZFSJ,120),7) = left(convert(varchar(10),:as_date),120),7) ) ) CurrentActualRent
from HX_ProjectApply where isnull(fFlag,'0') ='1' and isnull(fEndFlag,'0') ='0' ) A where isnull(currentrent,0)+isnull(SumOverdueRent,0) >0
|
|