UNION and ORDER BY

From: Cool Screen <cool_screen_name90001(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: UNION and ORDER BY
Date: 2002-11-07 20:21:25
Message-ID: 20021107202125.13241.qmail@web40603.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

With:

(select *
from table1
where col1=1
order by name)
union
(select *
from table1
where col1=2
order by random())

UNION apparently reorders all the rows of the result
in their natural order (sequence in which they where
inserted). Is there a way to have the first part of
the results ordered by name, and the second part by random()?

__________________________________________________
Do you Yahoo!?
U2 on LAUNCH - Exclusive greatest hits videos
http://launch.yahoo.com/u2

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2002-11-07 20:21:40 Re: OT: mailing list delays
Previous Message Doug McNaught 2002-11-07 20:09:36 Re: SPI_????