| From: | darren(at)crystalballinc(dot)com |
|---|---|
| To: | Greg Stark <gsstark(at)mit(dot)edu> |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: is it possible to do this? have a subselect that |
| Date: | 2003-09-03 18:44:30 |
| Message-ID: | Pine.LNX.4.44.0309031442550.14805-100000@thread.crystalballinc.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
You could try using it as a dynamic select as shown in the query below.
This would give you the answer by you would have to have a binding between
tab and the dynamic table z i believe
SELECT x,y,z,
z.a,
z.b
FROM tab,
(SELECT a,b FROM foo) z
HTH
Darren
On 3 Sep 2003, 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
>
> I don't think it's possible but it would simplify my life a whole heck of a
> lot if it was, so I figured I would double-check before tearing my hair out.
>
>
--
Darren Ferguson
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Greg Stark | 2003-09-03 18:47:35 | Re: Localization (for dates) Oracle vs. Postgresql |
| Previous Message | Jenny - | 2003-09-03 18:36:05 | OffsetNumber offnum (LOCKTag) |