ORDER BY in UNION query

From: Antony Paul <antonypaul24(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: ORDER BY in UNION query
Date: 2005-01-10 12:13:31
Message-ID: 2989532e0501100413665c136c@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,
I need to use ORDER BY clause in a UNION query and the Order BY
columns are not included in the SELECT statement. I tried like this

(select .... from a) UNION (select ..... from b) order by a.ename;

It says that
ERROR: Attribute "ename" not found

How to do this.

rgds
Antony Paul

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2005-01-10 12:15:32 Re: handing created and updated fields
Previous Message Jim C. Nasby 2005-01-10 11:28:47 handing created and updated fields