Re: Learning SQL: nested CTE and UNION

Поиск
Список
Период
Сортировка
От Jonatan Reiners
Тема Re: Learning SQL: nested CTE and UNION
Дата
Msg-id F8300A1E9780480898B92103499BFA78@encc.de
обсуждение исходный текст
Ответ на Learning SQL: nested CTE and UNION  (Adam Mackler <adammackler@gmail.com>)
Ответы Re: Learning SQL: nested CTE and UNION  (Adam Mackler <adammackler@gmail.com>)
Список pgsql-novice
I hope this gives you a clue.

This works:

WITH outmost AS (
SELECT 1
UNION (WITH innermost as (SELECT 2)
SELECT * FROM innermost 
)UNION SELECT 3 
)                     
SELECT * FROM outmost;

But this does not work:

WITH outmost AS (
SELECT 1
UNION (WITH innermost as (SELECT 2)
SELECT * FROM innermost
UNION SELECT 3)
)
SELECT * FROM outmost;

-- 
Jonatan Reiners

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

Предыдущее
От: Adam Mackler
Дата:
Сообщение: Learning SQL: nested CTE and UNION
Следующее
От: Adam Mackler
Дата:
Сообщение: Re: Learning SQL: nested CTE and UNION