pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Emmanuel Engelhart <emmanuel@engelhart.org>
To: pgsql-sql@postgresql.org
Subject: UNION & LIMIT & ORDER BY
Date: Sat, 14 Jun 2003 19:01:27 +0200
Message-ID: <20030614190127.51910c98.emmanuel@engelhart.org> (raw)

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



view thread (2+ messages)  latest in thread

Message-ID: <20030614190127.51910c98.emmanuel@engelhart.org>
Permalink:  ../20030614190127.51910c98.emmanuel@engelhart.org/
Also on:    postgresql.org/message-id/20030614190127.51910c98.emmanuel@engelhart.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: emmanuel@engelhart.org
  Subject: Re: UNION & LIMIT & ORDER BY
  In-Reply-To: <20030614190127.51910c98.emmanuel@engelhart.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox