Re: selecting all records where a column is null

From: Scott Marlowe <scott(dot)marlowe(at)ihs(dot)com>
To: "Elmshauser, Erik" <erike(at)pbgnw(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: selecting all records where a column is null
Date: 2002-06-20 20:19:52
Message-ID: Pine.LNX.4.33.0206201419300.8770-100000@css120.ihs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 20 Jun 2002, Elmshauser, Erik wrote:

> Hi, I am trying to select every record from a table where a specific
> column does not have a value in it yet. Is there a way to express that
> in a SQL statement? Here are the few I tried:
>
> select * from table where field;
> select * from table where field = '';
> select * from table where field = NULL;
>
> and some other stuff the is way more broken. I have flipped through the
> docs a bit but I haven't found anything useful yet. If someone could
> point me to the right place in the docs or give me an example of a
> select that will do this I would be very grateful.

Try

select * from table where field IS NULL;

--
"Force has no place where there is need of skill.", "Haste in every
business brings failures.", "This is the bitterest pain among men, to have
much knowledge but no power." -- Herodotus

In response to

Browse pgsql-general by date

  From Date Subject
Next Message terry 2002-06-20 20:40:38 Re: selecting all records where a column is null
Previous Message Gregory Seidman 2002-06-20 20:14:39 Re: circular REFERENCES