I have the following data structure
Customer | Order | Date | Amount | TransactionType
AABB | AB01 | 2012-06-01 | 3000 | Invoiced
AABB | AB01 | 2012-06-05 | 3000 | Payment
I need my data to be repeated from the day the invoice was presented to the day the payment was made. Like this;
Customer|Order|Date | AmountDue|AmountPaid|DatePaid |TransactionType
AABB |AB01 |2012-06-01| 3000 |NULL |2012-06-05|Invoiced
AABB |AB01 |2012-06-02| 3000 |NULL |2012-06-05|Invoiced
AABB |AB01 |2012-06-03| 3000 |NULL |2012-06-05|Invoiced
AABB |AB01 |2012-06-04| 3000 |NULL |2012-06-05|Invoiced
AABB |AB01 |2012-06-05| 3000 |3000 |2012-06-05|Payment
How can I create a SQL script for this scenario
Try This: