I have two columns, in charges column I have different charges like post, neg, transfer, drawer charges
| ref_no | charges |
|---|---|
| 001 | POSTEX USD 100 B^NEGO USD 200 B^TRAN USD 150 |
| 002 | POSTEX USD 400 B^TRAN USD 350 |
| 003 | NEGO USD 700 B^TRAN USD 350 |
| 004 | DRAW USD 700 |
Now what I want is like this:
| ref_no | POSTEX | NEGO | TRAN | DRAW |
|---|---|---|---|---|
| 001 | POSTEX USD 100 | NEGO USD 200 | TRAN USD 150 | |
| 002 | POSTEX USD 400 | TRAN USD 350 | ||
| 003 | NEGO USD 700 | TRAN USD 350 | ||
| 004 | DRAW USD 700 |
I have tried use lateral view + split but its not working, is there some other way I can do it using SparkSQL or MySql?