Re: change null to 0 in SQL script

From: ThomasR <trx(at)wtal(dot)de>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: change null to 0 in SQL script
Date: 2002-01-04 19:52:54
Message-ID: 3C360816.1080103@wtal.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Karl Raven wrote:

> I like to change a null value of a query to 0 in the SQL script. I know how
> to do it in MS-SQL server and MS-Access but those commands does not work in
> pg-sql.
>
> Anyone has any ideas?
>
> Thanks
>

I think the following should work:

select coalesce( my_attrib, 0 ) from my_tab

Thomas

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Chris Sypolt 2002-01-05 00:05:14 Re: SQL syntax help needed
Previous Message Bill Cunningham 2002-01-04 19:20:30 Re: Telling how many records are joined