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

Re: Subqueries in select clause

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Josh Berkus" <josh(at)agliodbs(dot)com>
Cc: Sara Cohen <sarina(at)cs(dot)huji(dot)ac(dot)il>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Subqueries in select clause
Date: 2001-04-18 18:33:14
Message-ID: 12360.987618794@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-sql
"Josh Berkus" <josh(at)agliodbs(dot)com> writes:
> Until you can upgrade, though, try this approach:

> CREATE VIEW c_aggregate AS
> SELECT sum(a) as sum_a, b FROM c GROUP BY b;

> SELECT max(sum_a) FROM c_aggregate;

Unfortunately that won't work in 7.0 --- grouped views have a lot of
problems in that version, and one of the problems is that you can't
do another level of aggregating on their results.

Basically a view and a subselect are the same thing, so you can't get
around the restrictions of one by using the other...

7.1 is what Sara needs.

			regards, tom lane

In response to

pgsql-sql by date

Next:From: Oleg BartunovDate: 2001-04-18 18:41:01
Subject: Re: RTREE on points
Previous:From: Diehl, JeffreyDate: 2001-04-18 18:28:57
Subject: RE: Re: DB porting questions...

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