Re: WITH Support - Mailing list pgsql-hackers

From Edwin S. Ramirez
Subject Re: WITH Support
Date
Msg-id 45953795.9090006@idconcepts.org
Whole thread Raw
List pgsql-hackers
The WITH that I am thinking about, lets you define and reuse queries which are executed once.  For example: 

WITH  MySummary AS (*SELECT b.dept_name, Sum(Salary) AS total_sal FROM emp a join dept b on (a.dept_id = b.dept_id)
GROUP BY b.dept_name*)  SELECT dept_name, total_sal //FROM MySummary  WHERE total_sal > (                     SELECT
SUM(total_sal) * 1/12                     FROM MySummary)  ORDER BY total_sal
 

You can introduce multiple "aliases" and use them within any subsequent queries.

WITH   alias1 as (...)  alias2 as (...)  alias3 as (...)
SELECT ....

Thanks,


> Edwin Ramirez wrote:
> > Hello,
> > 
> > What is the status of supporting the "WITH" keyword?
> 
> I see these TODO items:
> 
>     * Add SQL99 WITH clause to SELECT
>     * Add SQL:2003 WITH RECURSIVE (hierarchical) queries to SELECT
> 
> Are they the same item?



pgsql-hackers by date:

Previous
From: mark@mark.mielke.cc
Date:
Subject: Re: TODO: GNU TLS
Next
From: August Zajonc
Date:
Subject: Re: TODO: GNU TLS