Hi I have a dataset where I have to pick the second row and last row of the record. Below is the example
| Id | name | quantity | price |
| 456214 | Alex | 5.00 | 15.23 |
| 456214 | Raj | 10.00 | 100.00 |
| 456214 | Tim | 10.00 | 10.00 |
| 456214 | | 25.00 | 125.23 |
| 145267EX | Nick | 5.00 | 20.00 |
| 145267EX | Luffy | 5.00 | 60.00 |
| 145267EX | | 10.00 | 80.00 |
| 54123 | Leo | 5.00 | 10.00 |
| 54123 | | 5.00 | 10.00 |
Conditions:
1. You can see all the records have different Ids and from them, I have to select second record row but if only two rows are present just like the last record I have to pick the first row
2. I have to put the last record into the first row so all of them will be in the same row
Output:
| Id | name | quantity | Price | f1 | f2 |
| 456214 | Raj | 10.00 | 100.00 | 25.00 | 125.23 |
| 145267EX | Lufy | 5.00 | 20.00 | 10.00 | 80.00 |
| 54123 | Leo | 5.00 | 10.00 | 5.00 | 10.00 |
Let me know if you have any question