X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EA7153A3E1C for ; Mon, 8 Nov 2004 01:56:47 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 69302-10 for ; Mon, 8 Nov 2004 01:56:35 +0000 (GMT) Received: from druid.net (druid.net [216.126.72.98]) by svr1.postgresql.org (Postfix) with ESMTP id ECC1A3A3CB4 for ; Mon, 8 Nov 2004 01:56:38 +0000 (GMT) Received: from imp.druid.net (imp [216.126.72.111]) by druid.net (Postfix) with SMTP id 2AE0C1C07; Sun, 7 Nov 2004 20:56:44 -0500 (EST) Date: Sun, 7 Nov 2004 20:56:26 -0500 From: "D'Arcy J.M. Cain" To: "John B. Scalia" Cc: pgsql-sql@postgresql.org Subject: Re: query using a date field that isn't set Message-Id: <20041107205626.3db6a856.darcy@druid.net> In-Reply-To: <0I6K008ES6EI0H@chimmx04.algx.net> References: <0I6K008ES6EI0H@chimmx04.algx.net> X-Mailer: Sylpheed version 0.9.12 (GTK+ 1.2.10; i386--netbsdelf) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200411/60 X-Sequence-Number: 19379 On Tue, 02 Nov 2004 10:44:41 -0500 "John B. Scalia" 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 | 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.