The WITH that I am thinking about, lets you define and reuse queries which are executed once. For example:
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
ORDER BY total_sal
You can introduce multiple "aliases" and use them within any subsequent queries.
alias1 as (...)
alias2 as (...)
alias3 as (...)
> 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
|Next:||From: Brian Hurt||Date: 2006-12-29 15:45:04|
|Subject: Re: [PATCHES] [BUGS] BUG #2846: inconsistent and|
|Previous:||From: Stephen Frost||Date: 2006-12-29 15:38:42|
|Subject: Re: TODO: GNU TLS|