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
---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your
message can get through to the mailing list cleanly