I have a table in a database:
DRN | VoucherNo | CrDRN
-----------------------
1 |80 |?
2 |11 |?
3 |11 |?
4 |80 |?
5 |11 |?
I'm trying to get the DRN number for the CrDRN column.
It is calculated like this:
- The
CrDRNof every row with the voucher type will be itsDRNnumber - Any row with the
VoucherTypeof 11 will have theDRNnumber of the previous record where theVoucherTypeequals 80
So in this instance the CrDRN column values will be:
1
1
1
5
5
I was thinking I'd need to use a Where VoucherType = 80
But I can't wrap my head around the concept of the second 80
Any help would be appreciated