pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Denis <sqllist@coralindia.com>
To: pgsql-sql@postgresql.org
Subject: Re: ORDER BY TIMESTAMP_column ASC, NULL first
Date: Mon, 16 Feb 2004 13:27:02 +0530
Message-ID: <006c01c3f462$77bf3d60$0f32a8c0@denisnew> (raw)
References: <20040212100626.GA21864@csbnet.se>
	<1076871769.10896.140.camel@jester>

Hi Rod,

Try this....

ace=> create table test(name text, age int );
CREATE
ace=> insert into test values ('Denis',26);
INSERT 1823531 1
ace=> insert into test values (null,26);
INSERT 1823532 1
ace=> select * from test order by name;
 name  | age
-------+-----
 Denis |  26
       |  26
(2 rows)

ace=> select * from test order by coalesce(name,'');
 name  | age
-------+-----
       |  26
 Denis |  26     

HTH

Thanx

Denis

----- Original Message ----- 
From: "Rod Taylor" <pg@rbt.ca>
To: "Fredrik Wendt" <fredrik@csbnet.se>
Cc: <pgsql-sql@postgresql.org>
Sent: Monday, February 16, 2004 12:32 AM
Subject: Re: [SQL] ORDER BY TIMESTAMP_column ASC, NULL first


> On Thu, 2004-02-12 at 05:06, Fredrik Wendt wrote:
> > Hi!
> > 
> > I read posts telling me that NULL values are considered greater than
> > non-null values. Fine. Is there a way to explicitly reverse this?
> 
> ORDER BY column IS NOT NULL, column ASC;
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)





view thread (6+ messages)  latest in thread

Message-ID: <006c01c3f462$77bf3d60$0f32a8c0@denisnew>
Permalink:  ../006c01c3f462$77bf3d60$0f32a8c0@denisnew/
Also on:    postgresql.org/message-id/006c01c3f462$77bf3d60$0f32a8c0@denisnew

 · 

reply

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: sqllist@coralindia.com
  Subject: Re: ORDER BY TIMESTAMP_column ASC, NULL first
  In-Reply-To: <006c01c3f462$77bf3d60$0f32a8c0@denisnew>

* 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