pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andreas Joseph Krogh <andreak@officenet.no>
To: Kancha . <kancha2np@yahoo.com>
To: pgsql-sql@postgresql.org
Subject: Re: replace NULL
Date: Tue, 9 Apr 2002 14:14:49 +0200
Message-ID: <200204091414.49688.andreak@officenet.no> (raw)
In-Reply-To: <20020409120003.46895.qmail@web14910.mail.yahoo.com>
References: <20020409120003.46895.qmail@web14910.mail.yahoo.com>

On Tuesday 09 April 2002 14:00, Kancha . wrote:
> Hello
>
> i want to run a select query on a table. eg:
>
> select age from people;
>
> if age is NULL then I want to replace it by some text,
> say "SHY" so the output is like
>
> name age
> me   10
> jane SHY
> jack 32
>
> how do i make this replacement of null value to some text
>

select name, COALESCE(age, 'SHY') from people;

-- 
Andreas Joseph Krogh (Senior Software Developer) <andreak@officenet.no>
A hen is an egg's way of making another egg.



view thread (4+ messages)  latest in thread

Message-ID: <200204091414.49688.andreak@officenet.no>
Permalink:  ../200204091414.49688.andreak@officenet.no/
Also on:    postgresql.org/message-id/200204091414.49688.andreak@officenet.no

 · 

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: andreak@officenet.no, kancha2np@yahoo.com
  Subject: Re: replace NULL
  In-Reply-To: <200204091414.49688.andreak@officenet.no>

* 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