Replace null values

From: Nilesh Govindarajan <lists(at)itech7(dot)com>
To: pgsql-general General <pgsql-general(at)postgresql(dot)org>
Subject: Replace null values
Date: 2010-03-23 04:11:44
Message-ID: 4BA83F80.80101@itech7.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

In my query, some rows have null values (length 0).

I wish to replace them with some constant.

I think I am wrong somewhere in this query using coalesce():

select coalesce(u.name, 'anon'), nodecount from users u, ( select n.uid
userid, count(n.nid) nodecount from node n group by n.uid order by n.uid
) t1 where u.uid = t1.userid order by nodecount;

The output is same as that of without coalesce.

--
Nilesh Govindarajan
Site & Server Administrator
www.itech7.com

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2010-03-23 04:37:04 Re: Replace null values
Previous Message Petru Ghita 2010-03-23 03:52:46 Re: string functions and operators