i having difficulty trying combine set of queries using. having execute multiple queries different years , cid numbers. (cid 1-5, years currentyear currentyear-6) current sql statement: select 1 cid, 2015 `year`, ( select sum( legacy_reports_payments.amountpaid ) * -1 payments legacy_reports_payments datepaid >= "2015-01-01 00:00:00" , datepaid < "2015-02-01 00:00:00" , cid = 1) paymentsjan, ( select sum( legacy_reports_payments.amountpaid ) * -1 payments legacy_reports_payments datepaid >= "2015-02-01 00:00:00" , datepaid < "2015-03-01 00:00:00" , cid = 1) paymentsfeb, ( select sum( legacy_reports_payments.amountpaid ) * -1 payments legacy_reports_payments datepaid >= "2015-03-01 00:00:00" , datepaid < "2015-04-01 00:00:00" , cid= 1) paymentsmar, ... this returns: cid | year | paymentsjan | paymentsfeb | ... 1 | 2015 | 3000.00 | 3000.00 | ...
Comments
Post a Comment