From: | Torbj=?ISO-8859-1?B?9g==?=rn Andersson <tobbe(at)embryo(dot)se> |
---|---|
To: | "Kancha (dot)" <kancha2np(at)yahoo(dot)com>, <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: replace NULL |
Date: | 2002-04-10 11:42:05 |
Message-ID: | B8D9F1AD.22F5%tobbe@embryo.se |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Hi,
>> 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
If you want to change the presentation but not the actual data you can use:
SELECT name, CASE
WHEN age IS NULL
THEN 'SHY'
ELSE age
END AS age
FROM people
I think there is a function called coalesce (sp?) that does roughly the same
as the CASE-clause above.
Best Regards
Torbjörn "Toby" Andersson
---------------------------------------------------
Embryo Communication phone: +46 (0) 31-774 39 11(00)
Kungsgatan 7a fax: +46 (0)31 774 07 80
S-411 19 Gothenburg mobile: 0708-30 70 04
Sweden home: http://www.embryo.se/
mail: torbjorn(dot)andersson(at)embryo(dot)se
---------------------------------------------------
"A human being should be able to change a diaper, plan an invasion, butcher
a hog, conn a ship, design a building, write a sonnet, balance accounts,
build a wall, set a bone, comfort the dying, take orders, give orders,
cooperate, act alone, solve equations, analyze a new problem, pitch manure,
program a computer, cook a tasty meal, fight efficiently, die gallantly.
Specialization is for insects"
From | Date | Subject | |
---|---|---|---|
Next Message | Jeff Eckermann | 2002-04-10 15:44:16 | Re: new problem! Is there any Faster workaround ?? |
Previous Message | Rajesh Kumar Mallah | 2002-04-10 11:25:33 | Postgresql goes into recovery mode .... |