Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

405
Vistas
Split data from a column and insert to another table in postgresql

I'm trying to split data from Username column in a table like this:

Table1
ID  Username
1   UserA,UserB,UserC

and I want to insert it to another table. the result will be like this:

Table2
ID  Username
1   UserA
1   UserB
1   UserC

is this possible to do this in postgresql?

thanks in advance

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You can split the value and then unnest it:

insert into table2 (id, username)
select t1.id, ut.username
from table1 t1
  cross join unnest(string_to_array(t1.username), ',')) as ut(username)
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda