Re: Multiple SELECT statements Using One WITH statement

David G. Johnston <david.g.johnston@gmail.com>

From: "David G. Johnston" <david.g.johnston@gmail.com>
To: Avi Weinberg <AviW@gilat.com>
Cc: "pgsql-general@lists.postgresql.org" <pgsql-general@lists.postgresql.org>
Date: 2022-01-20T12:58:24Z
Lists: pgsql-general
On Thursday, January 20, 2022, Avi Weinberg <AviW@gilat.com> wrote:

> Hi,
>
>
>
> 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 ….;
>
>
> With q1 as (), q2 as (), q3 as () main_query

David J.