Re: Multiple SELECT statements Using One WITH statement
Ken Tanzer <ken.tanzer@gmail.com>
From: Ken Tanzer <ken.tanzer@gmail.com>
To: "David G. Johnston" <david.g.johnston@gmail.com>
Cc: Avi Weinberg <AviW@gilat.com>, "pgsql-general@lists.postgresql.org" <pgsql-general@lists.postgresql.org>
Date: 2022-01-20T23:32:10Z
Lists: pgsql-general
On Thu, Jan 20, 2022 at 8:46 AM David G. Johnston < david.g.johnston@gmail.com> wrote: > You can always write: > > CREATE VIEW cte_view AS > WITH cte AS (...) > SELECT * FROM cte; > > And then incorporate that into any queries that require the results of > said CTE. > > Is there any advantage to still using a CTE inside the view definition, and then selecting it? Instead of just CREATE VIEW cte_view AS (...); Just curious, in case I'm missing something! Cheers, Ken -- AGENCY Software A Free Software data system By and for non-profits *http://agency-software.org/ <http://agency-software.org/>* *https://demo.agency-software.org/client <https://demo.agency-software.org/client>* ken.tanzer@agency-software.org (253) 245-3801 Subscribe to the mailing list <agency-general-request@lists.sourceforge.net?body=subscribe> to learn more about AGENCY or follow the discussion.