Skip site navigation (1) Skip section navigation (2)

Re: WITH Support

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: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
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
                      FROM MySummary)
   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 HurtDate: 2006-12-29 15:45:04
Subject: Re: [PATCHES] [BUGS] BUG #2846: inconsistent and
Previous:From: Stephen FrostDate: 2006-12-29 15:38:42
Subject: Re: TODO: GNU TLS

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group