pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedquery using a date field that isn't set
2+ messages / 2 participants
[nested] [flat]
* query using a date field that isn't set
@ 2004-11-02 15:44 John B. Scalia <jscalia@cityblueprinting.com>
0 siblings, 1 reply; 2+ messages in thread
From: John B. Scalia @ 2004-11-02 15:44 UTC (permalink / raw)
To: pgsql-sql
Hi all,
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);
And that gives me all the old employees (where the field has a value), but
for the life of me, I can't figure out the syntax to use for employees that
haven't been terminated or quit. Everything I've tried returns no rows.
Anybody?
--
John
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: query using a date field that isn't set
@ 2004-11-08 01:56 D'Arcy J.M. Cain <darcy@druid.net>
parent: John B. Scalia <jscalia@cityblueprinting.com>
0 siblings, 0 replies; 2+ messages in thread
From: D'Arcy J.M. Cain @ 2004-11-08 01:56 UTC (permalink / raw)
To: John B. Scalia <jscalia@cityblueprinting.com>; +Cc: pgsql-sql
On Tue, 02 Nov 2004 10:44:41 -0500
"John B. Scalia" <jscalia@cityblueprinting.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@druid.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.
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2004-11-08 01:56 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-11-02 15:44 query using a date field that isn't set John B. Scalia <jscalia@cityblueprinting.com>
2004-11-08 01:56 ` D'Arcy J.M. Cain <darcy@druid.net>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox