From: Stoyan Genov <genov@digsys.bg>
To: Peter Eisentraut <peter_e@gmx.net>
Cc: tgl@sss.pgh.pa.us
Cc: Inoue@tpf.co.jp
Cc: pgman@candle.pha.pa.us
Cc: lutzeb@aeccom.com
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] Howto to force NULL rows at the bottom ?
Date: Mon, 06 Dec 1999 11:16:43 +0200
Message-ID: <199912060916.LAA27713@lorna.digsys.bg> (raw)
In-Reply-To: <Pine.LNX.4.20.9912051642510.349-100000@localhost.localdomain>
Sorry, sorry, sorry :-(((
I HAVE tested it, but with the WRONG test.
Please do not laugh too loud...
lorna:[11:03]:/usr/home/genov/
: createdb tmp
lorna:[11:03]:/usr/home/genov/
: psql tmp
Welcome to the POSTGRESQL interactive sql monitor:
Please read the file COPYRIGHT for copyright terms of POSTGRESQL
type \? for help on slash commands
type \q to quit
type \g or terminate with semicolon to execute query
You are currently connected to the database: tmp
tmp=> select version();
version
--------------------------------------------------------------------
PostgreSQL 6.5.2 on i386-unknown-freebsd3.1, compiled by gcc 2.7.2.1
(1 row)
tmp=> create table a (d datetime default now()+'@60 days', t text);
CREATE
tmp=> insert into a (t) values (NULL);
INSERT 458155 1
tmp=> \g
INSERT 458156 1
tmp=> \g
INSERT 458157 1
tmp=> insert into a (t) values ('a');
INSERT 458158 1
tmp=> insert into a(t) values ('b');
INSERT 458159 1
tmp=> insert into a(t) values ('c');
INSERT 458160 1
tmp=> select * from a;
d |t
----------------------------+-
Fri 04 Feb 11:04:45 2000 EET|
Fri 04 Feb 11:04:51 2000 EET|
Fri 04 Feb 11:04:52 2000 EET|
Fri 04 Feb 11:05:08 2000 EET|a
Fri 04 Feb 11:05:14 2000 EET|b
Fri 04 Feb 11:05:26 2000 EET|c
(6 rows)
tmp=> select * from a order by t;
d |t
----------------------------+-
Fri 04 Feb 11:05:08 2000 EET|a
Fri 04 Feb 11:05:14 2000 EET|b
Fri 04 Feb 11:05:26 2000 EET|c
Fri 04 Feb 11:04:45 2000 EET|
Fri 04 Feb 11:04:51 2000 EET|
Fri 04 Feb 11:04:52 2000 EET|
(6 rows)
tmp=> select * from a order by t desc;
d |t
----------------------------+-
Fri 04 Feb 11:05:26 2000 EET|c
Fri 04 Feb 11:05:14 2000 EET|b
Fri 04 Feb 11:05:08 2000 EET|a
Fri 04 Feb 11:04:45 2000 EET|
Fri 04 Feb 11:04:51 2000 EET|
Fri 04 Feb 11:04:52 2000 EET|
(6 rows)
tmp=>
I just DID NOT put the "order by" clause in the first select, so the tuples
with the NULL
values appeared first. But that isn't ordered selection :-(
I apologize. I am really sorry.
Regards,
Stoyan Genov
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: genov@digsys.bg, peter_e@gmx.net, tgl@sss.pgh.pa.us, Inoue@tpf.co.jp, pgman@candle.pha.pa.us, lutzeb@aeccom.com
Subject: Re: [SQL] Howto to force NULL rows at the bottom ?
In-Reply-To: <199912060916.LAA27713@lorna.digsys.bg>
References: <Pine.LNX.4.20.9912051642510.349-100000@localhost.localdomain> <199912060916.LAA27713@lorna.digsys.bg>
* 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