Skip site navigation (1) Skip section navigation (2)

Re: Selecting time periods

From: "Hartman, Matthew" <Matthew(dot)Hartman(at)krcc(dot)on(dot)ca>
To: "Peter Jackson" <tasmaniac(at)iprimus(dot)com(dot)au>, "pgsql" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Selecting time periods
Date: 2009-07-15 12:16:26
Message-ID: 366642367C5B354197A1E0D27BC175BD022598CC@KGHMAIL.KGH.ON.CA (view raw or flat)
Thread:
Lists: pgsql-novice
> From: pgsql-novice-owner(at)postgresql(dot)org [mailto:pgsql-novice-
> owner(at)postgresql(dot)org] On Behalf Of Peter Jackson
> Subject: [NOVICE] Selecting time periods

>   I've tried SELECT shift from shift_times where '17:00' between start
> AND finish;
>   Which works for A and C but if I change the 17:00 to 19:30 it
returns
> no rows.

Just taking a guess here, but how about:

SELECT shift FROM shift_times WHERE '19:30' BETWEEN least(start,finish)
AND greatest(start,finish);

Matthew Hartman
Programmer/Analyst
Information Management, ICP
Kingston General Hospital
.now.


In response to

pgsql-novice by date

Next:From: Crystal BEWZADate: 2009-07-15 17:47:11
Subject: Re: Where to find libpq.lib? Or How to link to libpq using windows VS
Previous:From: Greg StarkDate: 2009-07-15 06:54:59
Subject: Re: presence/absence

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group