I have one question about how to fill column looking for previous values.
My problem is that the column "abandoned" need to follow some rules to be filled. The rules are:
- The column "abandoned" should be filled with "yes" or "no", choosing one value or another. Never i get two "yes" values followed.
- Always **after ** the column "date_hour_canceled_negotiation" is filled, the column "abandoned" should be filled with "yes" and when the column "date_hour_negotiation" or "date_hour_canceled_negotiation" is filled, in same row, the column "abandoned" should be filled with "no".
Could someone help me please? Any help i appreciate a lot.
I would like to do something like this:
contract | date_hour_access | date_hour_negotiation | date_hour_canceled_negotiation | status_negotiation | abandoned |
---|---|---|---|---|---|
111111 | 2022-12-01 10:20:00 | yes | |||
111111 | 2022-12-02 10:20:00 | no | |||
111111 | 2022-12-03 10:20:00 | yes | |||
111111 | 2022-12-04 10:20:00 | 2022-12-04 10:30:00 | active | no | |
111111 | 2022-12-05 10:20:00 | 2022-12-05 10:30:00 | canceled | no | |
111111 | 2022-12-06 10:20:00 | yes | |||
111111 | 2022-12-07 10:20:00 | no |