Received: from alpha.xerox.com (firewall-user@alpha.Xerox.COM [13.1.64.93]) by hub.org (8.8.8/8.7.5) with SMTP id IAA04685 for ; Wed, 17 Jun 1998 08:34:27 -0400 (EDT) Received: from viper ([13.1.159.1]) by alpha.xerox.com with SMTP id <56301(4)>; Wed, 17 Jun 1998 05:34:23 PDT Received: from bentley.eso.mc.xerox.com (bentley.wc.eso.mc.xerox.com) by viper (4.1/SMI-4.1) id AA27720; Wed, 17 Jun 98 08:33:31 EDT Received: by bentley.eso.mc.xerox.com (SMI-8.6/SMI-SVR4) id IAA01017; Wed, 17 Jun 1998 08:33:29 -0400 From: kcolagio@wc.eso.mc.xerox.com (Kevin Colagio) Message-Id: <199806171233.IAA01017@bentley.eso.mc.xerox.com> Subject: [SQL] Time related question... To: pgsql-sql@postgreSQL.org Date: Wed, 17 Jun 1998 05:33:29 PDT X-Mailer: ELM [version 2.4 PL25] Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit I have a database that tracks the service calls we do. In the database are abstime values for: dateentered dateclosed dateassigned datecontacted I have perl scripts managing the interaction between our web site and the database. My question is: what is the SQL statement that will allow me to find: 1) a list of the calls where the difference between the dateentered and dateclosed is less than (say) 3 days. I have tried: Select * from servicecall where (dateentered <#> dateclosed) #<= 3 days; Select * from servicecall where (dateclosed - dateentered) #<= 3 days; Select * from servicecall where (dateentered <#> dateclosed) #<= @3 days; Select * from servicecall where (dateclosed - dateentered) #<= @3 days; Any suggestions? Thanks. -- Kevin Colagio, Systems Administrator, Webmaster, and perpetual student. kcolagio@wc.eso.mc.xerox.com Personal URL: