0
I have a table like this below, with the date, one, debit amount, credit value, and the balance sheet value (debit value + 0 - credit value) and I need that each time there is a debit and credit value and the same document number, which are equal, or when the sum of the balance is equal to zero.
I tried to do a function but I could only signal when there are two records with the same number and the result of the balance gives 0, which in the example below would be the lines where a = 219900. But I wanted to signal all those who are among ** .
Someone can help me?
data num debito credito balanco zero_balanco
11/11/2016 219900 470,00 -470,00 Y
11/11/2016 219900 470,00 470,00 Y
01/11/2016 218295 163,00 163,00
30/11/2016 218295 162,00 162,00 **Y**
30/11/2016 218295 162,00 162,00 **Y**
30/11/2016 218295 162,00 -162,00 **Y**
30/11/2016 218295 162,00 -162,00 **Y**
30/11/2016 218295 162,00 162,00
25/10/2016 218102 935,46 935,46 **Y**
25/10/2016 218102 935,46 -935,46 **Y**
25/10/2016 218102 935,46 935,46
20/10/2016 217638 1.896,65 1.896,65 **Y**
20/10/2016 217638 1.896,65 -1.896,65 **Y**
20/10/2016 217638 1.896,65 1.896,65 **Y**
20/10/2016 217638 1.896,65 -1.896,65 **Y**
20/10/2016 217638 1.696,65 1.696,65
Unfortunately only that doesn’t work...
– thiagofred
What’s the matter ?
– Motta
thus, it only signals when the difference between credit and debit is zero... and yet, I have to be independent of the date, because a debit release in month 10 can be credited on later dates/months
– thiagofred
Apart from the group by ?! select num , s .... group by num
– Motta