I am using teradata for some data modification. My table current looks like:
|Appl_id| Account_no|
|123 |40001|
|123 |40002|
|125 |40233|
|125 |40234|
|125 |40235|
|126 |40647|
and I want to convert this into :
|Appl_id|Acc_no1|Acc_no2|Acc_no3|
|123 |40001 |40002 | – |
|125 |40233 |40234 |40235 |
|126 |40647 | – | – |
Since the number of accounts can go upto 9, I would not be able to use min max average as a work around.Not sure if partition by would be applicable here as well.
What I think I can do is order by appl_id, Account_no and then select row1, row2, row3…but I am not sure if I can do that.
Please suggest
thanks