select
id
,rnwfees1
,count(cd.subscriberid) as cnt
,sum(revenue) as actalamt
,TIMESTAMPDIFF(MONTH,commisiondate,now())+1 as cnt
,renewalfee*(TIMESTAMPDIFF(MONTH,commisiondate,now())+1) as expected
From corporatesubscribers cs
inner join po_location pl on pl.wo_no=cs.workorderid and pl.loc_code=cs.loc_code
inner join special_plans sp on cs.packageid=sp.packageid
inner join corporatedisbursement cd on cd.subscriberid=cs.cosubid
where cs.workorderid='WOPO/0005/TN/0002'
group by cd.id
id |rnwfees1 | cnt | actalamt | cnt | expected |
1 | 2199.00 | 14 | 30786.00 | 21 | 46179.00 |
2 | 2199.00 | 14 | 30786.00 | 20 | 43980.00 |
3 | 2199.00 | 14 | 30786.00 | 20 | 43980.00 |
4 | 2199.00 | 14 | 30786.00 | 22 | 48378.00 |
5 | 2199.00 | 14 | 30786.00 | 21 | 46179.00 |
我想要总和(actalamt)。我试过了。