Unir filas de tabla en PLSQL usando sentencia simple

  • Autor Autor zamora4343
  • Fecha de inicio Fecha de inicio
Z

zamora4343

Gamma
Verificación en dos pasos activada
Verificado por Whatsapp
Buenas!!

Quiero.. en PLSQL unir varias filas de una tabla, en una.. por ejemplo:

Tengo una tabla..

PAÍS PROVINCIA

ESPAÑA - ZAMORA
ESPAÑA - VALLADOLID
ESPAÑA - PALENCIA

y quiero que me devuelva

ESPAÑA - ZAMORA - VALLADOLID - PALENCIA.

¿Es posible hacerlo con una sentencia?


Muchas gracais!!
 
Utiliza la función CONCAT por ejemplo
 
Puedes usar las funciones lead y lag, para retornar la fila posterior o anterior en el conjunto de datos que retornar tu consulta:


lead ( value anyelement [, offset integer [, default anyelement ]] ) → anyelement
Returns value evaluated at the row that is offset rows after the current row within the partition; if there is no such row, instead returns default (which must be of the same type as value). Both offset and default are evaluated with respect to the current row. If omitted, offset defaults to 1 and default to NULL.

En este enlace esta mejor explicado:

Lead
 
Atrás
Arriba