Re: como manejar selects recursivos?

From: gonzalo sáenz <gonzalosaenz(at)gmail(dot)com>
To: Jaime Casanova <systemguards(at)gmail(dot)com>, pgsql-es-ayuda(at)postgresql(dot)org
Subject: Re: como manejar selects recursivos?
Date: 2005-02-28 22:01:48
Message-ID: 7ae163a40502281401bb5b9ee@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

en el directorio contrib existe un tipo de datos para lo que queres
hacer creo que se llama ltree, yo lo he probado y funciona bastante
rápido

salu2
gonzalo

On Mon, 28 Feb 2005 16:35:58 -0500, Jaime Casanova
<systemguards(at)gmail(dot)com> wrote:
> On Mon, 28 Feb 2005 13:41:28 -0600, Claudia Villa <cvilla75(at)hotmail(dot)com> wrote:
> > necesito hacer una consulta recursiva,
> > tengo la siguiente tabla:
> >
> > SELECT id,id_padre,nombre from temas;
> > id |id_padre| nombre
> > ----+---------- +--------------
> > 1 | | Tema 1
> > 2 | 1 | Sub Tema 1
> > 3 | 1 | Sub Tema 2
> > 4 | 2 | Sub Tema 1.1
> >
> > como hacer para que me muestre todos los hijos de un tema , incluyendo los
> > hijos de los hijos?
> >
> Parece por lo que dices que quieres que detecte dinamicamente si hay
> hijos de los hijos, no se si se pueda en SQL, imagino que dependeria
> mucho del dise~o de tus tablas. En todo caso lo que si puedes hacer es
> una funcion en pl/pgsql que te retorne las filas que necesitas
>
> atentamente,
> Jaime Casanova
> Puedo hace
>
> ---------------------------(fin del mensaje)---------------------------
> TIP 1: para suscribirte y desuscribirte, escribe a majordomo(at)postgresql(dot)org
>

--
When things are investigated, then true knowledge is achieved;
when true knowledge is achieved, then the will becomes sincere;
when the will becomes sincere, then the heart sees correctly;
when the heart sees correctly, then the personal life is
cultivated;when the personal life is cultivated, then the family life
is regulated;
when the family life is regulated, then the national life is orderly;
and when the national life is orderly, then there is peace in this world.

Confucius

In response to

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Lizarraga, Juan (MABE,REF,TI) 2005-02-28 22:02:26 RE: como manejar selects recursivos?
Previous Message Diego Gil 2005-02-28 21:56:06 Re: como manejar selects recursivos?