RE: sql that is making my brain hurt

From: Stephens, Chris <chris_stephens_at_admworld.com>
Date: Wed, 20 Feb 2008 10:18:07 -0600
Message-ID: <7070047601C21A4CB387D50AD3661F6E091778BB@050EXCHANGE.research.na.admworld.com>


What I need is 1 row per hour from the start date up to and not including the end date.

-----Original Message-----
From: David Lord [mailto:dlordster_at_gmail.com] Sent: Wednesday, February 20, 2008 10:14 AM To: Stephens, Chris
Cc: oracle-l_at_freelists.org
Subject: Re: sql that is making my brain hurt

SQL> select resource_id, start_res from dcl_1   2 union
  3 select resource_id, end_res from dcl_1 order by 2;

RESOURCE_ID START_RES

----------- -------------------
          1 2008-02-20 16:11:16
          1 2008-02-20 16:11:23
          1 2008-02-20 17:11:16
          1 2008-02-20 18:11:23

Regards
David Lord

On 20/02/2008, Stephens, Chris <chris_stephens_at_admworld.com> wrote:
>
>
>
>
> I am writing a scheduling application in apex. Resources are reserved
by
> hour. I need a calendar to show when resources are reserved.
>
>
>
> In the 'day view' of that calendar I need the schedule split out by
hour.
>
>
>
> Resource_id number
>
> Start_res date
>
> End_res date
>
>
>
> If I have a row like: 1, Jan 01 2008 8am, Jan 01 2008 10am, I need the
query
> to return:
>
>
>
> 1, Jan 1 2008 8am
>
> 1,Jan 1 2008 9am
>
>
>
> So far I've been unable to come up with the sql. Anybody got a quick
> answer?
>
>
>
>
>
> It is amazing how hard sql seems when you haven't had to write
anything of
> any substance in a long time.
>
>
>
> Thanks!
>
>
>
>
>
>
> CONFIDENTIALITY NOTICE:
> This message is intended for the use of the individual or entity to
which
> it is addressed and may contain information that is privileged,
> confidential and exempt from disclosure under applicable law. If the
reader
> of this message is not the intended recipient or the employee or agent
> responsible for delivering this message to the intended recipient, you
are
> hereby notified that any dissemination, distribution or copying of
this
> communication is strictly prohibited. If you have received this
> communication in error, please notify us immediately by email reply.

CONFIDENTIALITY NOTICE:
        This message is intended for the use of the individual or entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient or the employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by email reply.

--
http://www.freelists.org/webpage/oracle-l
Received on Wed Feb 20 2008 - 10:18:07 CST

Original text of this message