Unir linhas de tabela no PLSQL usando sentença simples

  • Autor Autor zamora4343
  • Data de início Data de início
Tradução em andamento: em alguns minutos este tópico estará em português. Por enquanto, o conteúdo está no original em espanhol. Ver original
Z

zamora4343

Gamma
Verificación en dos pasos activada
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!!
 
Foi útil? Participe da conversa

Com sua conta grátis você pode responder, mandar mensagem privada ao autor e comprar com Saldo retido: o pagamento é liberado quando você recebe o combinado.

Leva 30 segundos · você volta a este tópico ao terminar
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
 
Voltar
Topo