Re: Multiple SELECT statements Using One WITH statement

Поиск
Список
Период
Сортировка
От Josef Šimánek
Тема Re: Multiple SELECT statements Using One WITH statement
Дата
Msg-id CAFp7Qwp1Ymz0ZD7z2vN7D+3+xd4Z8tFXK+PSbD2XNePdT1GZmA@mail.gmail.com
обсуждение исходный текст
Ответ на Multiple SELECT statements Using One WITH statement  (Avi Weinberg <AviW@gilat.com>)
Список pgsql-general
čt 20. 1. 2022 v 13:48 odesílatel Avi Weinberg <AviW@gilat.com> napsal:
>
> Hi,
Hello!
>
>
> Can I have multiple select statements using one WITH statement?
>
>
>
> WITH t AS (
>
>     Select A, B from …
>
> )
>
> SELECT A into tableA FROM t where ….;
>
>
>
> SELECT B into tableB FROM t where ….;
>

I think it is not possible that way. Instead you can "cache" the query
result into a temporary table. CREATE TEMPORARY TABLE  ... ON COMMIT
DROP could be useful here. There is simple example mentioned in this
(https://stackoverflow.com/a/52384424/319233) stackoverflow answer.
>
> IMPORTANT - This email and any attachments is intended for the above named addressee(s), and may contain information
whichis confidential or privileged. If you are not the intended recipient, please inform the sender immediately and
deletethis email: you should not copy or use this e-mail for any purpose nor disclose its contents to any person. 



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