Re: timestamp interval issue - Mailing list pgsql-novice

From Lonni J Friedman
Subject Re: timestamp interval issue
Date
Msg-id 7c1574a90710051653r233922b5j3c56d3d3bc371913@mail.gmail.com
Whole thread Raw
In response to Re: timestamp interval issue  (Michael Glaesemann <grzm@seespotcode.net>)
Responses Re: timestamp interval issue  (Michael Glaesemann <grzm@seespotcode.net>)
List pgsql-novice
On 10/5/07, Michael Glaesemann <grzm@seespotcode.net> wrote:
>
> On Oct 5, 2007, at 18:46 , Lonni J Friedman wrote:
>
> > Thanks. I gave this a try (cut & paste exactly what you provided), but
> > I'm getting a syntax error at the final semicolon?
>
> Ah. I forgot the END of the CASE statement. Give this a try:
>
> select count(date_created)
> from footable0
> where case when current_time < '16:00'::time
>             then date_created between (current_date - 1) + interval
> '16 hours'
>                                 and current_date + interval '16 hours'
>             else date_created between current_date + interval '16 hours'
>                                 and (current_date + 1) + interval '16
> hours'
>           end;

That looks perfect.  At least, after a few simple tests its returning
expected results.  I'll beat on this some more over the weekend.

I didn't even realize that PostgreSQL supported conditional
statements.  Had I known, this would have been alot easier.  Guess I
need to RTFM alot more.

Many thanks!

pgsql-novice by date:

Previous
From: Michael Glaesemann
Date:
Subject: Re: timestamp interval issue
Next
From: Michael Glaesemann
Date:
Subject: Re: timestamp interval issue