Re: [SQL] Subqueries in select clause

2001-04-18 Thread Tom Lane
"Josh Berkus" <[EMAIL PROTECTED]> 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 v

Re: [SQL] Subqueries in select clause

2001-04-18 Thread Josh Berkus
Sara, Hey! Great to see that Postgres has made it to Israel. What's the most popular Linux distribution there? I think you have your answer ... an upgrade. RPMs for most major distributions of Linux should be available within the week. Until you can upgrade, though, try this approach: CREA

Re: [SQL] Subqueries in select clause

2001-04-18 Thread Richard Huxton
Sara Cohen <[EMAIL PROTECTED]> said: > Hi, > > I am attempting to use subqueries in the select clause of a query > and am encountering difficulties. > > The Problem: > > > I would like to use a subquery that returns one column, but more than one > tuple. The result of this subquer

Re: [SQL] Subqueries in select clause

2001-04-18 Thread Stephan Szabo
On Wed, 18 Apr 2001, Sara Cohen wrote: > The Problem: > > > I would like to use a subquery that returns one column, but more than one > tuple. The result of this subquery is then used in an aggregate function. > > For example, suppose I have a table c, with columns a and b of > num

Re: [SQL] Subqueries in select clause

2001-04-18 Thread Tom Lane
Sara Cohen <[EMAIL PROTECTED]> writes: > Using Oracle, I could get by this problem with: > select max(d) from ((select count(b) as d from c group by a)); > However, my version of postgres doesn't support subqueries in the from > clause. Time to update to 7.1... rega