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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-novice by date

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