Topic: Date of the last debt

Good afternoon!
Help to understand how to solve the task, please)
It is necessary to receive the list of credits which at the moment of calculation have outstanding debts, and to calculate for each such credit:
Date started of current delay. The delay date started, in the given task is understood as the first date of the continuous period, in which total sum of the delayed outstanding debt> 0.
Date Date
Customer Number of the client
Deal credit Number
Currency credit Currency
Sum the total carried out on delay ("+") or paid ("-")
Date Customer Deal Currency Sum
12/12/2009 111110 111111 RUR 12000
25.12.2009 111110 111111 RUR 5000
12.12.2009 111110 122222 RUR 10000
12.01.2010 111110 111111 RUR-10100
20.11.2009 220000 222221 RUR 25000
20.12.2009 220000 222221 RUR-25000
21.12.2009 220000 222221 RUR 20000
22.12.2009 220000 222221 RUR 20000
29.12.2009 111110 122222 RUR-10000


Re: Date of the last debt

Dasha995 wrote:


Structure give in the form of CREATE TABLE.

Dasha995 wrote:

the Data gives the Example in the form of INSERT INTO, or at least in tag Table.
And still, setting an example of the data, give also the desirable answer to THIS data.