asked on
I have a table with transactions.
The columns are:
trxid,date,payee,category,amount,split
trxid is sequential transaction ID although with gaps here and there.
Split is either blank or S. S is for when a row is the sum of following rows.
The problem is that the row which has S has date and the payee and the amount, while the following component transactions only have the amounts but no date or payee.
What I want to do is go through the table and fill in the empty date and payee where missing with the date and payee of the preceding row with the S entry in the split column.
Example
trxid | Date | Payee | Category | Amount | Split |
1 | 01/08/2000 | Tesco | Shopping | -10 | S |
2 | Shopping | -8 | |||
3 | Household | -2 | |||
4 | 05/09/2000 | BP | Petrol | -100 | |
5 | 06/09/2000 | Brady | Clothing | -55 | |
8 | 10/10/2000 | Argos | Laptop | -400 | S |
9 | Laptop | -329.99 | |||
10 | Toys | -70.01 | |||
15 | 12/10/2000 | Maplins | Electronics | -15.99 | |
16 | 15/10/2000 | HMRC | Stolen income | -200 | |
17 | 15/10/2000 | Employer | Salary | 1000 |
So as you can see, trxid 2 and 3 are missing date and payee and they need to be the same date and payee as trxid 1.
Same things with trxid 9 and 10 inheriting date and payee of trxid 8.
Hope this is clear.
I have tried and failed so your help will be much appreciated.