Re: Getting to grips with Recursive CTEs.

Поиск
Список
Период
Сортировка
От Pól Ua Laoínecháin
Тема Re: Getting to grips with Recursive CTEs.
Дата
Msg-id CAF4RT5TxSd8wyEmYJkzuohcwGStvvyct=EKeOOsxc0_A6QaYvQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Getting to grips with Recursive CTEs.  ("Miguel Beltran R." <yourpadre@gmail.com>)
Список pgsql-novice
Hola Miquel,

y gracias por tu contribución,

> You are not using a recursive function because it is needed to call the table "rcte" in the UNION ALL
> But it will fail because t3.parent is null at the beginning, so try this another one

> WITH rcte (child, parent) AS
> (
>   SELECT parent AS child, '' AS parent FROM tree t1
>     WHERE Parent NOT IN (SELECT child FROM tree)
>   UNION ALL
>   SELECT t2.child, t3.parent FROM tree t2
>   JOIN rcte t3 ON t2.parent >= t3.parent
> )

> I haven't tried.

That's great - I've played around with it a wee bit - still have a lot
to learn! :-)

Haven't had too much time - but I think it's slowly dawning on me.

Best regards,

Pól...



В списке pgsql-novice по дате отправления:

Предыдущее
От: Potvin, Jérémi
Дата:
Сообщение: RE: Security question
Следующее
От: Pól Ua Laoínecháin
Дата:
Сообщение: Re: Getting to grips with Recursive CTEs.