Search Postgresql Archives

Re: JOIN a UNION

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks that did it!

On Aug 6, 11:33 am, pavel.steh...@xxxxxxxxx (Pavel Stehule) wrote:
> Hello
>
> SELECT ... FROM
>   (SELECT ... FROM A
>    UNION ALL
>    SELECT FROM B) s1
>  JOIN C IN C.z = s1.z;
>
> Regards
> Pavel Stehule
>
> 2009/8/6 david.schruth <dschr...@xxxxxxxxx>:
>
>
>
> > I just realized what I posted was perfectly valid SQL. The following
> > is more what I had in mind:
>
> > (SELECT x,y,z FROM A
> > UNION
> > SELECT x,y,z FROM B)
> > AB JOIN C ON C.z = AB.z
>
> > This version certainly does throw an error.
>
> > Basically I'm wondering if there is a way to get Postgres to treat the
> > result of a UNION as a table on which I could perform subsequent
> > operations (like a JOIN).
>
> > On Aug 6, 10:43 am, "david.schruth" <dschr...@xxxxxxxxx> wrote:
> >> Simple question:
>
> >> Is there a way to do something like the following:
>
> >> SELECT x,y,z FROM A
> >> UNION
> >> SELECT x,y,z FROM B
> >> JOIN C ON C.z = B.z
>
> >> Thanks,
>
> >> Dave
>
> > --
> > Sent via pgsql-general mailing list (pgsql-gene...@xxxxxxxxxxxxxx)
> > To make changes to your subscription:
> >http://www.postgresql.org/mailpref/pgsql-general
>
> --
> Sent via pgsql-general mailing list (pgsql-gene...@xxxxxxxxxxxxxx)
> To make changes to your subscription:http://www.postgresql.org/mailpref/pgsql-general


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux