mysql - adding a value of group by fucntion -
select id ,rnwfees1 ,count(cd.subscriberid) cnt ,sum(revenue) actalamt ,timestampdiff(month,commisiondate,now())+1 cnt ,renewalfee*(timestampdiff(month,commisiondate,now())+1) expected corporatesubscribers cs inner join po_location pl on pl.wo_no=cs.workorderid , 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 cs.workorderid='wopo/0005/tn/0002' group 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 |
i want sum(actalamt). itried it. pls 1 solve issues
i'm guessing you're looking with rollup
modifier. here's doc: http://dev.mysql.com/doc/refman/5.7/en/group-by-modifiers.html
Comments
Post a Comment