From: CoL <col@mportal.hu>
To: pgsql-sql@postgresql.org
Subject: Re: VIEW / ORDER BY + UNION
Date: Fri, 18 Feb 2005 09:26:26 +0100
Message-ID: <cv48la$m4p$1@news.hub.org> (raw)
In-Reply-To: <cv2ea4$1cfv$2@news.hub.org>
References: <cv2ea4$1cfv$2@news.hub.org>
hi,
WeiShang wrote, On 2/17/2005 16:46:
> Hi, I have created a view like this :
>
> CREATE VIEW v1 AS (SELECT orderno,weekday,time FROM t1,t2 where
> t1.orderno=t2.orderno);
>
> if I create a SQL statment:
>
> (SELECT orderno FROM v1 WHERE weekday='MON' ORDER BY orderno)
> UNION
> (SELECT orderno FROM v1 WHERE weekday='WED' ORDER BY orderno)
> UNION
> (SELECT orderno FROM v1 WHERE weekday='FRI' ORDER BY orderno);
>
> Will the whole result will be sorted by the field orderno?
nothing says it will. you havet to sort the set of unions.
(select orderno ) union (select orderno ) order by orderno.
Not necessary now (no sense), to use order by in selects inside union.
C.
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: col@mportal.hu
Subject: Re: VIEW / ORDER BY + UNION
In-Reply-To: <cv48la$m4p$1@news.hub.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