Re: UNION not working... why? - Mailing list pgsql-general

From Richard Huxton
Subject Re: UNION not working... why?
Date
Msg-id 4761628F.4070002@archonet.com
Whole thread Raw
In response to UNION not working... why?  (Stefan Schwarzer <stefan.schwarzer@grid.unep.ch>)
List pgsql-general
Stefan Schwarzer wrote:
> Hi there,
>
> I have two rather simple queries, which I would to UNION, but somehow I
> always get an error message for the UNION ("ERROR:  syntax error at or
> near "UNION"")

> SELECT
> ORDER BY
> LIMIT 1
>
> UNION ALL
...

I think it's complaining about the order by/limit. The UNION is part of
the standard SELECT grammar and has its own ORDER BY (if you see what
I'm getting at).

Try SELECT * FROM (SELECT ... ORDER BY) AS foo UNION ...


--
   Richard Huxton
   Archonet Ltd

pgsql-general by date:

Previous
From: Stefan Schwarzer
Date:
Subject: UNION not working... why?
Next
From: "Pavel Stehule"
Date:
Subject: Re: UNION not working... why?