From: | "Edwin S(dot) Ramirez" <ramirez(at)idconcepts(dot)org> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: WITH Support |
Date: | 2006-12-29 15:43:17 |
Message-ID: | 45953795.9090006@idconcepts.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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?
From | Date | Subject | |
---|---|---|---|
Next Message | Brian Hurt | 2006-12-29 15:45:04 | Re: [PATCHES] [BUGS] BUG #2846: inconsistent and |
Previous Message | Stephen Frost | 2006-12-29 15:38:42 | Re: TODO: GNU TLS |