Received: from mjtsa.com (mjtgtw2.mjt.ch [194.209.241.21]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eBCFrlm90649 for ; Tue, 12 Dec 2000 10:53:48 -0500 (EST) (envelope-from bc@mjtsa.com) Received: (from bc@localhost) by mjtsa.com (8.9.2/dc) id QAA01449 for pgsql-sql@postgresql.org; Tue, 12 Dec 2000 16:49:48 GMT Date: Tue, 12 Dec 2000 16:49:48 GMT From: Blaise Carrupt Message-Id: <200012121649.QAA01449@mjtsa.com> To: pgsql-sql@postgresql.org Subject: Re: SQL Query using time Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-MD5: LkdcuyFZj31P1+AL58wamA== X-Archive-Number: 200012/88 X-Sequence-Number: 421 > Is it possible to carry out the comparison in the following manner > select name from table where 00:12 is between 23:58 and 00:30 You could try something like WHERE ('00:12' BETWEEN startTime AND endTime AND startTime <= endTime) OR ('00:12' NOT BETWEEN endTime AND startTime AND startTime > endTime) Should work slower, but should work... And take care to equality with BEWTEEN. ____________ B. Carrupt