Skip site navigation (1) Skip section navigation (2)

Re: comparing nulls

From: "D'Arcy J(dot)M(dot) Cain" <darcy(at)druid(dot)net>
To: Kenneth Gonsalves <lawgon(at)thenilgiris(dot)com>,pgsql-sql(at)postgresql(dot)org
Subject: Re: comparing nulls
Date: 2004-01-20 14:06:19
Message-ID: 200401200906.19322.darcy@druid.net (view raw or flat)
Thread:
Lists: pgsql-sql
On January 20, 2004 08:43 am, Kenneth Gonsalves wrote:
> in postgres7.1 i had a table where an integer field could be null. There
> was no default value. a select statement like so:
> 'select * from table where field = null'
> would give all the rows where that field had no value.
> on porting to 7.3.2, this doesnt work. How to do this?

As per the SQL standard:

SELECT * FROM table WHERE field IS NOT NULL;

-- 
D'Arcy J.M. Cain <darcy(at){druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.

In response to

pgsql-sql by date

Next:From: Kenneth GonsalvesDate: 2004-01-20 14:24:21
Subject: Re: comparing nulls
Previous:From: Chris BowlbyDate: 2004-01-20 13:56:57
Subject: Re: comparing nulls

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group