Re: is it possible to do this? have a subselect that

From: Ron <rstpierre(at)syscor(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: is it possible to do this? have a subselect that
Date: 2003-09-04 18:04:44
Message-ID: 3F577EBC.4060209@syscor.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ron Johnson wrote:

>On Wed, 2003-09-03 at 13:49, Ron wrote:
>
>
>>see below....
>>
>>Greg Stark wrote:
>>
>>
>>
>>>So I have a query in which some of the select values are subqueries. The
>>>subqueries are aggregates so I don't want to turn this into a join, it would
>>>become too complex and postgres would have trouble optimizing things.
>>>
>>>So my question is, is there some way to have a subselect return multiple
>>>columns and break those out in the outer query?
>>>
>>>Something like:
>>>
>>>SELECT x,y,z,
>>> (SELECT a,b FROM foo) AS (sub_a,sub_b)
>>> FROM tab
>>>
>>>
>>>
>>SELECT x, y, z, SS.*
>> FROM tab, (SELECT a,b FROM foo) SS
>>
>>
>
>But where's the join between tab and foo? Wouldn't you then get
>a combinatorial explosion?
>
>
>
Oops, forgot to put the join in. And having re-read the original post I
can see that's what Greg was wanting to avoid. I'll just crawl back to
my corner now.........

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrew J. Kopciuch 2003-09-04 18:07:41 Re: tsearch2 and unexpected exists
Previous Message Andy Harrison 2003-09-04 17:59:51 Re: postmaster processes