I’m trying to figure out how to put a specific value between two flag values, for example:
there is
id | date | flg |
---|---|---|
123 | 01.01.2024 | 1 |
432 | 02.01.2024 | |
5234 | 03.01.2024 | |
12342 | 06.01.2024 | 1 |
1256 | 07.01.2024 | |
246 | 08.01.2024 | |
846 | 09.01.2024 | |
834 | 15.01.2024 | 1 |
343 | 11.01.2024 | |
364 | 12.01.2024 |
Should be
| id | date | flg | hash |
|——-|————|—–|——-|
| 123 | 01.01.2024 | 1 | afaef |
| 432 | 02.01.2024 | | afaef |
| 5234 | 03.01.2024 | | afaef |
| 12342 | 06.01.2024 | 1 | jdrjd |
| 1256 | 07.01.2024 | | jdrjd |
| 246 | 08.01.2024 | | jdrjd |
| 846 | 09.01.2024 | | jdrjd |
| 834 | 15.01.2024 | 1 | qwwa |
| 343 | 11.01.2024 | | qwwa |
| 364 | 12.01.2024 | | qwwa |
Desc:
We define a range of lines between the first flag=1(inclusive) and the next one and create a new attribute with the value hash from id where the first flag is
A Y is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.