Search Postgresql Archives

Re: Multiple SELECT statements Using One WITH statement

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



čt 20. 1. 2022 v 13:48 odesílatel Avi Weinberg <AviW@xxxxxxxxx> 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 which is confidential or privileged. If you are not the intended recipient, please inform the sender immediately and delete this email: you should not copy or use this e-mail for any purpose nor disclose its contents to any person.






[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux