Re: [GENERAL] ORDER BY in UNION query

2005-01-17 Thread Antony Paul
Thanks Tom it worked. rgds Antony Paul On Mon, 10 Jan 2005 08:39:50 -0500, Tom Lane <[EMAIL PROTECTED]> wrote: > Richard Huxton writes: > > Antony Paul wrote: > >> 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

Re: [GENERAL] ORDER BY in UNION query

2005-01-10 Thread Tom Lane
Richard Huxton writes: > Antony Paul wrote: >> 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

Re: [GENERAL] ORDER BY in UNION query

2005-01-10 Thread John Sidney-Woollett
Try select a.col1 as ename from a union select b.othercolumn as ename from b order by ename Give the columns you want to order on the same name using the "as XXX" syntax, and remove the "a." prefix from the order statement. John Sidney-Woollett Antony Paul wrote: Hi, I need to use ORDER BY cl

Re: [GENERAL] ORDER BY in UNION query

2005-01-10 Thread Richard Huxton
Antony Paul wrote: 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. The "o

[GENERAL] ORDER BY in UNION query

2005-01-10 Thread Antony Paul
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