UNION & LIMIT & ORDER BY

From: Emmanuel Engelhart <emmanuel(at)engelhart(dot)org>
To: pgsql-sql(at)postgresql(dot)org
Subject: UNION & LIMIT & ORDER BY
Date: 2003-06-14 17:01:27
Message-ID: 20030614190127.51910c98.emmanuel@engelhart.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi

Why this query doesn't work ?

<<
SELECT
'1' AS id
FROM
users
ORDER BY id
LIMIT 1
UNION
SELECT
'2' AS id
FROM
users
>>

And this one work ?

<<
SELECT
'1' AS id
FROM
users
UNION
SELECT
'2' AS id
FROM
users
ORDER BY id
LIMIT 1
>>

--
-------------------------------------------------------------------------
| Dans le cours d'un long gouvernement, on va au mal par une pente |
| insensible, et ne remonte au bien que par un effort. |
| Montesquieu, "de l'esprit des lois" livre V/VII |
-------------------------------------------------------------------------
Emmanuel Engelhart alias Kelson | ICQ UIN : 53388731 | TEL 01.58.46.04.79

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message The Hermit Hacker 2003-06-14 23:31:50 WHERE of an AGGREGATE ...
Previous Message scott.marlowe 2003-06-13 21:04:14 Re: How to make a IN without a table... ?