|

楼主 |
发表于 2014-8-12 14:52:38
|
显示全部楼层
ksql查询的语句如下(用的“收款合计”和“付款合计”):
select BU_XMXXB.fSZDW as fSZDW,BU_XMXXB.fXMJL as fXMJL,BU_XMXXB.fXMMC as fXMMC,BU_XMXXB.fXMJE as fXMJE,(sum(BU_XMSKB.fKPJE)) as SUMSKJE,(sum(BU_XMYSZFB.fJE)) as SUMFKJE
from BU_XMXXB BU_XMXXB
optional join BU_XMSKB BU_XMSKB on BU_XMXXB.fXMBH = BU_XMSKB.fXMBH
optional join BU_XMYSZFB BU_XMYSZFB on BU_XMXXB.fXMBH = BU_XMYSZFB.fXMBH
where ( BU_XMSKB.fSKRQ >= :p1 AND BU_XMSKB.fSKRQ <= :p2 ) AND ( BU_XMYSZFB.fFKRQ >= :p1 AND BU_XMYSZFB.fFKRQ <= :p2 ) AND BU_XMXXB.fSZDW = :p3
group by BU_XMXXB.fSZDW, BU_XMXXB.fXMBH
order by BU_XMXXB.fXMJL asc
收款日期和付款日期都大于p1小于p2,以“所属单位”和“项目编号”汇总,以“项目经理”排序。请教各位了! |
|