X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0F6B43A4690 for ; Wed, 27 Oct 2004 16:25:54 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 94318-05 for ; Wed, 27 Oct 2004 15:25:48 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id 8312E3A4646 for ; Wed, 27 Oct 2004 16:25:47 +0100 (BST) Received: (qmail 14714 invoked by uid 500); 27 Oct 2004 15:36:43 -0000 Date: Wed, 27 Oct 2004 10:36:43 -0500 From: Bruno Wolff III To: Wei Weng Cc: pgsql-sql@postgresql.org Subject: Re: How do you compare (NULL) and (non-NULL)? Message-ID: <20041027153643.GA14288@wolff.to> Mail-Followup-To: Wei Weng , pgsql-sql@postgresql.org References: <417EB238.1000109@kencast.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <417EB238.1000109@kencast.com> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200410/197 X-Sequence-Number: 19300 On Tue, Oct 26, 2004 at 16:23:20 -0400, Wei Weng wrote: > In the following query > > SELECT Parent FROM Channels ORDER BY Parent ASC; > > If I have a couple of (NULL)s in the field [Parent], they will be listed at > the bottom of the query result. > > Is it because PostgreSQL considers (NULL) as the biggest value? If I run > the same query under MSSQL Server 2000, I get the exact opposite result > regarding the order of (NULL)s and (non-NULL) values. They are listed at > the very beginning of the query result. If the order matters, you can order by IS NULL or IS NOT NULL.