2
I have to generate a statement in the database that is similar to the bank statement and present the cumulative balance.
I have the following columns
Data, Debito, Crédito.
Data entry is daily but the statement I need is per month.
01/01/2015 – Credito 100
02/01/2015 – Débido 30
02/01/2015 – credito 70
01/02/2015 – debito 50
01/02/2015 – credito 80
02/02/2015 – debito 20
01/03/2015 – credito 60
01/03/2015 – debito 20
data debito credito saldo
01/01/2015 100 100
02/01/2015 30 70
02/01/2015 70 140
01/02/2015 50 90
01/02/2015 80 170
01/02/2015 20 150
01/03/2015 60 210
01/03/2015 20 190
The result that should be:
data debito credito saldo
jan 30 170 140
fev 70 80 150
mar 20 60 190
Have you done in the format without grouping per month? Put there how is the query then it is easier to adapt only the part you are in doubt.
– Maniero
Hello I haven’t done anything yet I’m trying to elaborate yet.
– CristianeBaill
The Balance is not accumulating, he has to catch the movement to land to generate the new balance... SELECT sum(value) the value, sum(nfvalue) the credit, (sum(nfvalue)-sum(value)) the balance, month, year FROM
lc_movimento
WHERE idemp = '22' and (cat ='149' or cat ='170') GROUP BY mes, year ORDER BY year, month, day– CristianeBaill
This is already the answer?
– Maniero