I need output for the below sample. the trip number has to be generated for each carrier, truck, trip eligibility combination. but if the trip eligibility has 'N' then the previous row trip number should be considered. i.e. the elibility flag 'N' indicates that that trip is single trip of previous record. Anyone can help for this??? Thanks.
Carrier | Truckno | Trip Elg | TripNo | SlNo |
A | aa | Y | 1 | 1 |
A | aa | N | 1 | 2 |
A | aa | N | 1 | 3 |
A | aa | Y | 2 | 4 |
A | aa | Y | 3 | 5 |
A | aa | N | 3 | 6 |
A | aa | Y | 4 | 7 |
A | bb | Y | 1 | 8 |
A | bb | N | 1 | 9 |
A | bb | Y | 2 | 10 |
A | bb | Y | 3 | 11 |
A | bb | Y | 4 | 12 |
B | ac | Y | 1 | 13 |
B | ac | N | 1 | 14 |
B | ac | N | 1 | 15 |
B | ac | Y | 2 | 16 |
B | ac | N | 2 | 17 |
B | ad | Y | 1 | 18 |