I have a SQL table in a Postgres server with several names per id and I need to distribute them by rows. The file is like that:
| Id | Names |
| AA00001X | "Agent_1, Agent_2, Agent_3" |
| BA00002X | "Agent_1, Agent_6" |
| CA00002X | "Agent_4, Agent_2" |
| DA00001Y | "Agent_2" |
What I need is a table like this:
| Id | Name |
| AA00001X | "Agent_1" |
| AA00001X | "Agent_2" |
| AA00001X | "Agent_3" |
| BA00002X | "Agent_1" |
| BA00002X | "Agent_6" |
| CA00002X | "Agent_4" |
| CA00002X | "Agent_2" |
| DA00001Y | "Agent_2" |
I tried to use a R interface and to build a code that would be able to do that. Nevertheless, the initial file is huge (3.1 Go) and R is not able to deal with it due to my configuration. I think it would be easier to do it directly on SQL but I am not expert in SQL code.