Received: from danbo.digsys.bg (root@danbo.digsys.bg [192.92.129.10]) by hub.org (8.9.3/8.9.3) with ESMTP id EAA86456 for ; Mon, 6 Dec 1999 04:16:56 -0500 (EST) (envelope-from genov@lorna.digsys.bg) Received: from lorna.digsys.bg (root@lorna.digsys.bg [193.68.6.15]) by danbo.digsys.bg (8.9.0/8.9.0) with ESMTP id LAA23548; Mon, 6 Dec 1999 11:16:51 +0200 (EET) Received: from lorna.digsys.bg (genov@localhost.digsys.bg [127.0.0.1]) by lorna.digsys.bg (8.9.0/8.9.0) with ESMTP id LAA27713; Mon, 6 Dec 1999 11:16:50 +0200 (EET) Message-Id: <199912060916.LAA27713@lorna.digsys.bg> X-Mailer: exmh version 2.0.2 2/24/98 To: Peter Eisentraut cc: tgl@sss.pgh.pa.us, Inoue@tpf.co.jp, pgman@candle.pha.pa.us, lutzeb@aeccom.com, pgsql-sql@postgresql.org Subject: Re: [SQL] Howto to force NULL rows at the bottom ? In-reply-to: Your message of "Sun, 05 Dec 1999 23:56:28 +0100." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 06 Dec 1999 11:16:43 +0200 From: Stoyan Genov Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by hub.org id EAA86463 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