pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
SQL Query using time
2+ messages / 2 participants
[nested] [flat]

* SQL Query using time
@ 2000-12-07 16:59 Karyn Keatley <K.Keatley@aepona.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Karyn Keatley @ 2000-12-07 16:59 UTC (permalink / raw)
  To: pgsql-sql

Hi,
I am attempting to write a sql query that compares times on a 24 hr
clock
eg
09:00<16:30 and  21:00>16:30

09:00 is the start time and 16:30 is the end time. The problem is that
if the start time is 23:58 and the end time is 00:30 (next day) is there
any way to carry out this comparison without introducing date.

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

thanks karyn

Attachments:

K.Keatley.vcf (text/x-vcard, 217B) download begin:vcard n:Keatley;Karyn x-mozilla-html:FALSE org:<IMG SRC="http://www.aepona.com/logo/aepona-vcard.gif"> adr:;;;;;; version:2.1 email;internet:k.keatley@aepona.com x-mozilla-cpt:;-15456 fn:Karyn Keatley end:vcard
^ permalink raw reply [nested|flat] 2+ messages in thread

* Re: SQL Query using time
@ 2000-12-12 16:49 Blaise Carrupt <bc@mjtsa.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Blaise Carrupt @ 2000-12-12 16:49 UTC (permalink / raw)
  To: 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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2000-12-12 16:49 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-12-07 16:59 SQL Query using time Karyn Keatley <K.Keatley@aepona.com>
2000-12-12 16:49 Re: SQL Query using time Blaise Carrupt <bc@mjtsa.com>

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