Re: SQL Query using time

From: Blaise Carrupt <bc(at)mjtsa(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: SQL Query using time
Date: 2000-12-12 16:49:48
Message-ID: 200012121649.QAA01449@mjtsa.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> 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

Browse pgsql-sql by date

  From Date Subject
Next Message Mike Castle 2000-12-12 16:56:28 Re: plpgsql
Previous Message Oliver Elphick 2000-12-12 16:20:39 Re: plpgsql