Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Summary with Group-by function on time (date-field)

Re: Summary with Group-by function on time (date-field)

From: Ed prochak <ed.prochak_at_alltel.com>
Date: 24 Apr 2002 13:27:52 -0700
Message-ID: <e51b160.0204241227.5db6adc8@posting.google.com>


"Thomas Stuefer" <stuefer_at_halli-data.at> wrote in message news:<B5sx8.15$zB2.164894_at_news.salzburg-online.at>...
> Hi !
>
> I use Oracle 8.1.7.2.7 and have a simple table:
>
> user VARCHAR2(30)
> duration DATE
>
>
> The data in this table looks like:
>
> USER DURATION
> ------------------------------------------------
> SCOTT 01.04.2002 01:30:00
> ADAMS 01.03.2002 00:45:00
> MILLER 01.04.2002 01:35:00
> SCOTT 01.04.2002 00:50:00
> SCOTT 01.02.2002 00:30:00
> MILLER 01.03.2002 00:10:00
> ADAMS 01.04.2002 00:20:00
> MILLER 01.02.2002 00:30:00
>
>
> How can I get the group-summary of duration on every user:
>
> USER SUM_DURATION
> ------------------------------------------------
> ADAMS 01:05:00
> MILLER 02:15:00
> SCOTT 02:50:00
>
>
> Remark: The date in the field "duration" is not important and can be
> ignored.
>
> Many thanks for your help !
>
> Thomas

Hints:

to get a duration, you need to define the start and end times.

duration = end - start
(taking the difference between two DATE values in ORACLE returns the duration in units of Days. Hours, minutes, and seconds are in the fractional part. e.g. 1.25 days is one day 6 hours.)

You should be able to find examples in your Oracle documentation. or your class textbook.
good luck,

   Ed

-- 
Edward J. Prochak   --- Magic Interface, Ltd.
Ofc: 440-498-3700
on the web at       --- http://www.magicinterface.com
email: ed.prochak_at_magicinterface.com
Received on Wed Apr 24 2002 - 15:27:52 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US