Re: query using a date field that isn't set

From: "D'Arcy J(dot)M(dot) Cain" <darcy(at)druid(dot)net>
To: "John B(dot) Scalia" <jscalia(at)cityblueprinting(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: query using a date field that isn't set
Date: 2004-11-08 01:56:26
Message-ID: 20041107205626.3db6a856.darcy@druid.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Tue, 02 Nov 2004 10:44:41 -0500
"John B. Scalia" <jscalia(at)cityblueprinting(dot)com> wrote:
> I've got a SQL problem that's stumping me. I have an employee table
> with a field labeled:
>
> Emp_terminated DATE
>
> Obviously, some employees in this table won't have this field set. I
> want a query to select only employees without this field being set,
> ie., only current employees. I've got the inverse working by using:
>
> SELECT * FROM employee WHERE ISFINITE(emp_terminated);

>From http://www.postgresql.org/docs/faqs/FAQ.html:

4.13) In a query, how do I detect if a field is NULL?

You test the column with IS NULL and IS NOT NULL.

--
D'Arcy J.M. Cain <darcy(at)druid(dot)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

Browse pgsql-sql by date

  From Date Subject
Next Message D'Arcy J.M. Cain 2004-11-08 02:03:03 Re: third edition of SQL FOR SMARTIES
Previous Message Tom Lane 2004-11-07 18:31:56 Re: tricky GROUP BY / JOIN question