Re: I need a SQL...

From: Adam Kavan <akavan(at)cox(dot)net>
To: Bjørn T Johansen <btj(at)havleik(dot)no>, "Andrew L(dot) Gould" <algould(at)datawok(dot)com>
Cc: PostgreSQL general list <pgsql-general(at)postgresql(dot)org>
Subject: Re: I need a SQL...
Date: 2003-09-11 19:10:20
Message-ID: 5.2.1.1.0.20030911140658.00ab3a00@pop.central.cox.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


>
>Yes, the period can exceed 12 hours, so what you are saying is that this
>is not possible to solve without the date part? I can write this logic in
>my business logic but I was hoping to solve this in my database layer... BTJ

How about SELECT CASE WHEN "StartTime" > "EndTime" THEN
'23:59:99.99999999999'::time - "StartTime" + "EndTime" ELSE
"EndTime"-"StartTime" END FROM "TimeTable";

--- Adam Kavan
--- akavan(at)cox(dot)net

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sean Chittenden 2003-09-11 19:24:39 Re: State of Beta 2
Previous Message Duffey, Kevin 2003-09-11 18:36:24 Re: how to replicate database