time between the start and end

I have reservation with 4 columns of table

start end id room
20.10.2011 09:00 20.10.2011 12:00 1 100

How can I get the following result

time room id
09:00 1 100
09:30 1 100
10:00 1 100
10:30 1 100
11:00 1 100
11:30 1 100
12:00 1 100

can someone help me?

It should work

WITH
    t AS
    (
        SELECT
            TO_DATE ('20-Oct-2011 09:00','dd-mon-yyyy hh24:mi') start_date_time,
            TO_DATE ('21-Oct-2011 11:30','dd-mon-yyyy hh24:mi') end_date_time,
            1 id,
            100 room
        FROM
            DUAL
        UNION ALL
        SELECT
            TO_DATE ('20-Oct-2011 09:00','dd-mon-yyyy hh24:mi') start_date_time,
            TO_DATE ('21-Oct-2011 11:00','dd-mon-yyyy hh24:mi') end_date_time,
            2 id,
            200 room
        FROM
            DUAL
    )
SELECT
    TO_CHAR(start_date_time + (column_value-1)*(1/(24*2)),'dd-mon-yyyy') start_dt,
    TO_CHAR(start_date_time + (column_value-1)*(1/(24*2)),'hh24:mi') start_time,
    id,
    room
FROM
    t,
     table(
       cast(
             multiset(
                         select  level
                           from  dual
                           connect by level <= ((end_date_time - start_date_time)*24*2) + 1
                       )
             as sys.OdciNumberList
            )
      );

Test case with the smaller date range

WITH
    t AS
    (
        SELECT
            TO_DATE ('20-Oct-2011 09:00','dd-mon-yyyy hh24:mi') start_date_time,
            TO_DATE ('20-Oct-2011 11:30','dd-mon-yyyy hh24:mi') end_date_time,
            1 id,
            100 room
        FROM
            DUAL
        UNION ALL
        SELECT
            TO_DATE ('20-Oct-2011 09:00','dd-mon-yyyy hh24:mi') start_date_time,
            TO_DATE ('20-Oct-2011 10:30','dd-mon-yyyy hh24:mi') end_date_time,
            2 id,
            200 room
        FROM
            DUAL
    )
SELECT
    TO_CHAR(start_date_time + (column_value-1)*(1/(24*2)),'dd-mon-yyyy') start_dt,
    TO_CHAR(start_date_time + (column_value-1)*(1/(24*2)),'hh24:mi') start_time,
    id,
    room
FROM
    t,
     table(
       cast(
             multiset(
                         select  level
                           from  dual
                           connect by level <= ((end_date_time - start_date_time)*24*2) + 1
                       )
             as sys.OdciNumberList
            )
      );

START_DT          START_TIME ID                     ROOM
----------------- ---------- ---------------------- ----------------------
20-oct-2011       09:00      1                      100
20-oct-2011       09:30      1                      100
20-oct-2011       10:00      1                      100
20-oct-2011       10:30      1                      100
20-oct-2011       11:00      1                      100
20-oct-2011       11:30      1                      100
20-oct-2011       09:00      2                      200
20-oct-2011       09:30      2                      200
20-oct-2011       10:00      2                      200
20-oct-2011       10:30      2                      200                    

 10 rows selected 

Thanks to Solomon Yakobson to its solution on thread:

Search for a string

I found the solution from there.

Tags: Database

Similar Questions

  • Photoshop CC 2015 is a line connecting the start and end of the brush strokes

    Hi guys,.

    I had a strange problem with a certain brush (size 5px, difficult tour, no shape dynamics, no transfer) in Photoshop CC 2015.1.2.

    It only happens when the drawing very fast on my Cintiq 22HD.

    The problem is PS is a line connecting the start and end of the brush strokes. I don't hold in shift or whatever it is.

    PScc_problem.jpg

    Here's my brush settings:
    Capture.JPG

    I use a PC with these specs:

    Intel Core i7 - 4790 K 4.00 GHz

    ASUS motherboard

    NVIDIA GeForce GTX 970 (10.18.13.5354 driver version)

    16 GB OF RAM

    Cintiq 22HD

    Win 10

    Is it a question of PS or Cintiq?

    Thanks for help.

    OK, here is therefore an update.

    The problem is not at all with Photoshop or Cintiq, with Windows 10 parameters of the stylus.

    Fortunately, there is a small piece of free software that you can download called "Fix my pen" (by Smith Reddy) which defines the features of Windows Tablet PC in the registry for you (essentially by disabling everything related to it):

    viziblr - News - difficulty my pen makes your Wacom tablet JUST WORK on Windows 7

    It works fine on Win10 too.

    Now, as my original problem with Photoshop to do a line connecting the start and end of the brush strokes left, however I have another question more small that came after running difficulty my pen. The lines that I draw now are not smoothed by a software more. You can see the difference below.

    Fix My Pen sets a lot of things in the registry, but you cannot individually control which setting is disabled. So I guess that one of them is the cause.

    I expect response from Smith about it, cause I have no idea who he is.

  • Need help to calculate the start and end time and place the result in a term like text box

    I did a search on the forum for calculating start and end time and found the code depending on which I am using as a formcalc on the duration field.
    ==============================================================
    Form1. Page1.duration::calculate - (FormCalc, client)

    If (HasValue (StartTime) and HasValue (EndTime)) then
    industrial var = Time2Num (StartTime.formattedValue, "h: mm A")
    var = Time2Num out_ (EndTime.formattedValue, "h: mm A")
    If (IN2 > = out_) then
    xfa.host.messageBox ("start time cannot be greater than or equal to the end time.")
    $.rawValue = null
    on the other
    var out_ - IN2 = diff
    $.rawValue = diff/3600000
    endif
    on the other
    $.rawValue = null
    endif
    =============================================================

    Then, when I enter for example from 15:30, an hour of beginning and end of 04:00

    The duration field will say 0.5

    How can I get my form to say 30 minutes instead of placing a decimal?

    Secondly, how can I use field models LC where the employee can just type 330 or 03:30 and it automatically based on the computer's clock on time to start 15:30?

    Any help will be greatly appreciated.  Thank you.

    Attached is the form for display:

    https://Acrobat.com/#d=f1kxh5qjuow5ujyZduF8OQ

    To view the results in a regular time format, you can use:

    $.rawValue = Num2Time (diff/3600000, "HH: mm")

    For a flexible time entry check this example.

    http://thelivecycle.blogspot.com/2011/05/flexible-Eingabe-von-Daten-und-Zeiten.html

  • Black horizontal lines on the LCD screen at a specific time during the start and stop

    Hi, I am currently using a Presario CQ61 Notebook PC.  My problem, as indicated in the title, are black lines on the LCD screen, apparently when the screen is reset or enclose itself turned off during the start and stop only. From the judgment, he produced a split second her stops the hard drive, after that the screen is black. The lines and then quickly disappear. At startup, lines appear after the Windows logo has passed and the screen went from black to start loading the login screen.

    The LCD is in perfect condition, all using the PC. No line, no discoloration, etc.. Nothing extraordinary either. The problem does occur only during these two periods, specifically. I am also unable to note the lines when I'm looking directly at the screen. I have to be standing next to the PC, at an angle.

    Now, I had this PC for a considerable amount of time, however, I never paid much attention to the screen when starting upwards or stop, so this could definitely be something that the laptop has done since I bought it. I also read on similar problems, and it could be an outdated video driver or BIOS.

    I want to just make sure that it is not a major problem. Thank you all!

    Hello

    You have a few options in my opinion please try these steps can help you solve your problem.

    1) click Start, type msconfig.exe in the start search box and press ENTER to start the System Configuration utility. Under the Services tab, click to select the hide all Microsoft services check box, and then go to tap Start , click on disable all. Click apply OK restart the device.

    (2) please visit the HP website and update the Bios and graphics drivers on the unit.

    Let us know how it goes!

    * Although I am an employee of HP, I speak for myself and not for HP.

    Click the White Star Kudos to say thank you *.

    Please check accept as Solution if it solves your problem *.

    Concerning

    Maton

  • can I choose the photo of the start and end positions to get rid of black borders?

    I tried to use the trial version of first elements 8 before buy you to see if it's able to do what I need to.

    I want to create a dvd photo, which is simple. I would like to use the scale feature to get rid of black borders and choose the start or end point of the photo.  the resolution of the photos are also terrible on screen, and when I import out in an uncompressed avi file. The photos are really high resolution and are very well in other programs.  Some of the photos sparkle even with anti flicker option enabled up to 100%.

    Adobe first elements may be able to make a dvd photo, or should I look at another adobe program?

    As Steve, pre can get you a DVD-video or a BD (for HD projects), but these will be on video and will be limited to the resolution of these two broadcast formats. If this is what you want, then the pre will do just fine.

    Regarding the images, I would NOT use all (or many) on the scale. Instead, I want to resize the images to match the size of the frame of the video project in Photoshop. This ARTICLE will give you some information and some advice.

    Good luck

    Hunt

  • Differences in time between the start date and end Date

    I have a requirement to get the difference between the two dates, I am on the syntax below to fill, but it does not work. The syntax is the following:
    TimestampDiff (SQL_TSI_MONTH, "[< dStart_Date_ITAG >]", '[< dEnd_Date_ITAG >]'). Could you please help me on this. Thanks in advance

    Olivier

    Hello Roytson,

    I want to enjoy the sytem itself, I mean there are 2 custom fields start date and enddate, my function should take system only do not enter manually.
    could you please develop this thing.

  • Set the start and end of a graph

    Hello

    I already searched the topic but have not found an answer. I'm a newbie to LabWindows.

    I write an application. For the application, there is a graph that shows a signal, axis is-> voltage and x-> time axis. By default the signal starts with the value 0 in the time axis. But my signal does not begin with 0. I would change the start value and the value of the end of the shaft manually. Does anyone know how it works (between AutoScaling)?

    I have also two x-axis in my chart. I put them with the offset (10 v and the other to-10V), but I would like to have two x axis starting with the 0 value in different heights. Is it possible to implement who?

    Best regards


  • Simple validation on the start and end dates

    Apex 4.2

    I'm trying to create a script of validation on my start date and end date. A simple validation indicating the start date must be less than the end date. Because apex deals my fields of date as a string, using an expression of pl/sql as P101_START_DATE < = P101_END_DATE does not work. This may seem like an easy question, but I'm unable to create this simple validation. Any help would be greatly appreciated. Thanks in advance!

    Take a look how the TO_DATE plsql function works... ie... to_date(:P101_START_DATE,'mm-DD-yyyy')<=to_date(:P101_END_DATE,'mm-dd-yyyy'),>

  • Calculate the start and end date in Connect By - during Hirerchy changes

    / * Formatted 05/20/2013 09:53 (PS5 v5.115.810.9015) * /.



    Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production

    Hello, can you please help me or guide me in the calculation of the dates of beginning and end to the underside of logic

    I want to calculate the Hirerchy Manager to the Agent.
    Then under query works fine and its giving me the expected results
    But when there is a change in the Hirerchy Manager or manager gets promoted
    Then I need to calculate the start date and end date.
    CREATE TABLE PERSON_DTL
    (
      SID                 VARCHAR2(10 BYTE),
      EMP_MGRS_ID         VARCHAR2(10 BYTE),
      START_EFFECTIVE_DT  DATE,
      END_EFFECTIVE_DT    DATE
    );
    
    Insert into PERSON_DTL
       (SID, EMP_MGRS_ID, START_EFFECTIVE_DT, END_EFFECTIVE_DT)
     Values
       ('M100', 'M107', TO_DATE('05/20/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('12/31/9999 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into PERSON_DTL
       (SID, EMP_MGRS_ID, START_EFFECTIVE_DT, END_EFFECTIVE_DT)
     Values
       ('M101', 'M102', TO_DATE('01/01/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('05/18/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into PERSON_DTL
       (SID, EMP_MGRS_ID, START_EFFECTIVE_DT, END_EFFECTIVE_DT)
     Values
       ('A100', 'M100', TO_DATE('01/01/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('12/31/9999 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into PERSON_DTL
       (SID, EMP_MGRS_ID, START_EFFECTIVE_DT, END_EFFECTIVE_DT)
     Values
       ('M100', 'M101', TO_DATE('01/01/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('05/18/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into PERSON_DTL
       (SID, EMP_MGRS_ID, START_EFFECTIVE_DT, END_EFFECTIVE_DT)
     Values
       ('M107', 'M102', TO_DATE('05/20/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('12/31/9999 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into PERSON_DTL
       (SID, EMP_MGRS_ID, START_EFFECTIVE_DT, END_EFFECTIVE_DT)
     Values
       ('M102', 'M103', TO_DATE('01/01/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('12/31/9999 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into PERSON_DTL
       (SID, EMP_MGRS_ID, START_EFFECTIVE_DT, END_EFFECTIVE_DT)
     Values
       ('M103', 'M104', TO_DATE('01/01/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('12/31/9999 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into PERSON_DTL
       (SID, EMP_MGRS_ID, START_EFFECTIVE_DT, END_EFFECTIVE_DT)
     Values
       ('A101', 'M105', TO_DATE('01/01/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('12/31/9999 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into PERSON_DTL
       (SID, EMP_MGRS_ID, START_EFFECTIVE_DT, END_EFFECTIVE_DT)
     Values
       ('M105', 'M106', TO_DATE('01/01/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('12/31/9999 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    COMMIT;
    SELECT   CONNECT_BY_ROOT (b.sid) agent_sid,
                 TRIM (
                    LEADING ',' FROM    SYS_CONNECT_BY_PATH (b.sid, ',')
                                     || ','
                                     || b.emp_mgrs_id
                 )
                    PATH,
                 START_EFFECTIVE_DT Start_dt,
                 END_EFFECTIVE_DT End_dt
          FROM   PERSON_DTL b
         WHERE   CONNECT_BY_ISLEAF = 1
    START WITH   sid IN ('A101', 'A100')
    CONNECT BY   PRIOR b.emp_mgrs_id = b.sid
    This is the results that i am getting now.
    
    AGENT_SID    PATH                       START_DT    END_DT
    
    A100    A100,M100,M101,M102,M103,M104    1/1/2010    12/31/9999
    A100    A100,M100,M107,M102,M103,M104    1/1/2010    12/31/9999
    A101    A101,M105,M106                   1/1/2010    12/31/9999
    Results Required
    
    A100    A100,M100,M101,M102,M103,M104    1/1/2010    5/18/2013
    A100    A100,M100,M107,M102,M103,M104    5/20/2013   12/31/9999
    A101    A101,M105,M106                   1/1/2010    12/31/9999

    WITH the CLAUSE will make it readable

    SQL> with paths as
      2  (
      3        SELECT   CONNECT_BY_ROOT (b.sid) agent_sid,
      4                 TRIM (
      5                    LEADING ',' FROM    SYS_CONNECT_BY_PATH (b.sid, ',')
      6                                     || ','
      7                                     || b.emp_mgrs_id
      8                 )
      9                  PATH,
     10                 START_EFFECTIVE_DT Start_dt,
     11                 END_EFFECTIVE_DT End_dt,rownum rn
     12        FROM   PERSON_DTL b
     13        START WITH   sid IN ('A101', 'A100')
     14        CONNECT BY   PRIOR b.emp_mgrs_id = b.sid
     15  ),
     16  flagged as
     17  (
     18      select agent_sid,
     19             path,
     20             start_dt,
     21             end_dt,rn,
     22             case when path like lag(path) over(order by rn)||'%' then 0 else 1 end flg
     23      from paths
     24  ),
     25  summed as
     26  (
     27      select agent_sid,path,start_dt,end_dt,
     28             sum(flg) over(order by rn) sm
     29      from flagged
     30  )
     31  select agent_sid,max(path) path,max(start_dt) start_dt,
     32         min(end_dt) end_dt
     33  from summed
     34  group by agent_sid,sm
     35  order by agent_sid;
    
    AGENT_SID  PATH                                     START_DT  END_DT
    ---------- ---------------------------------------- --------- ---------
    A100       A100,M100,M101,M102,M103,M104            01-JAN-10 18-MAY-13
    A100       A100,M100,M107,M102,M103,M104            20-MAY-13 31-DEC-99
    A101       A101,M105,M106                           01-JAN-10 31-DEC-99
    
  • REGEXP_REPLACE remove the start and end quotes.

    Hello guys,.

    I have a problem with my regular expression and I hope someone can help me with this?

    Imagine the following sample_data:

    {code}

    WITH sample_data AS

    (

    SELECT "'[email protected] "' double UNION ALL e

    SELECT "'[email protected] ' double UNION ALL e

    SELECT ' [email protected] "' double UNION ALL e

    SELECT "'[email protected] "' double UNION ALL e

    SELECT ' [email protected] "' double UNION ALL e

    SELECT "'[email protected] ' like e dual FROM

    )

    SELECT e, REGEXP_REPLACE (e, '(^'')? (. *) (''$)', '\2')

    OF sample_data;

    {code}

    I would like to remove all the quotes of beginning and end of the email. I made previous regexp, but she does not return the correct result. I know not why, but for some reason, when my email ends with a quote, the main quotation is not deleted.

    Can someone help me with this?

    Thank you

    Another solution...

    WITH sample_data AS
             (SELECT '''[email protected]''' AS e FROM DUAL
              UNION ALL
              SELECT '''[email protected]' AS e FROM DUAL
              UNION ALL
              SELECT '[email protected]''' AS e FROM DUAL
              UNION ALL
              SELECT '''[email protected]''''' AS e FROM DUAL
              UNION ALL
              SELECT '[email protected]''' AS e FROM DUAL
              UNION ALL
              SELECT '''''[email protected]' AS e FROM DUAL)
    SELECT e, REGEXP_REPLACE (e, '(^''+)|(''+$)')
      FROM sample_data
    
  • A lag time between the Palm and the exchange of calendar items

    Calendar on Exchange and the Palm items are turned off an hour.
    Exchange server, desktop PC and Palm are all resolved PST at the same time. Palm VersaMail account has been deleted and rebuilt.
    See the screenshots at http://picasaweb.google.com/lh/photo/kPKBDS28rhdVsextLM1PPQ?feat=directlink
    What is interesting is appointments in Outlook show up on top of the Palm an hour initially but they show the correct time in (parenthises) so the Palm seems to be a little aware of the problem.
    This same problem occurs on different Palm T / X with different Outlook accounts.
    Any suggestions are welcome

    You need this update:
    http://www.Palm.com/cgi-bin/cso_kbURL.cgi?id=9306

  • Calculate the elapsed time between the horodateurs log Table

    Hello

    I'm looking for some codes SQL allows to calculate the elapsed time between the timestamps in a log table.  The log table has some STOP-START operations.

    I just want to calculate the elapsed time between the START and PAUSE of Transactions, as well as START and EXECUTE transactions.

    So, in the example below, the time spent must be:

    START 09:15 break 09:20 (5 Minutes)
    START 09:30 to 09:45 (15 Minutes) FULL

    Total elapsed time for LOG_ID 1234 should be 20 minutes.  This excludes the 09:20 at 09:30 BREAK at the START time.

    LOG_ID

    SEQ_NUM

    LOG_TYPE_CD

    CRE_DTTM

    1234

    1

    BEGINNING

    09-15 - 2013:09:15:00

    1234

    2

    BREAK

    09-15 - 2013:09:20:00

    1234

    3

    BEGINNING

    09-15 - 2013:09:30:00

    1234

    4

    ALL THE

    09-15 - 2013:09:45:00

    Any suggestions?

    Thanks for your time

    -DT

    Hello

    Thanks for posting the CREATE TABLE and INSERT.  be sure to post the results desired from these data.

    user13071913 wrote:

    Hi thanks for the help...

    The date is a true timestamp.  ...

    Here's a sample of CREATE TABLE and a few inserts.  3 ID transaction, each with a series of journal entries.

    CREATE TABLE 'LOG_TABLE_X '.

    (SELECT 'ID' CHAR (14 BYTES) NOT NULL,)

    ACTIVATE THE "LOG_TYPE_FLG" TANK (4 BYTES) NOT NULL,

    ALLOW "LOG_DTTM" DATE NOT NULL

    );

    ...

    I'm so confused.  Is log_dttm a TIMESTAMP, you said in the story, or is it a DATE, as you say in the CREATE TABLE statement, or is it a VARCHAR2 as Thur INSERT statements?  I'll assume it's a DATE.

    I left out an important step yesterday.  The computation of the last_start, we need to use a CASE statement so that we record only the time of events STRT.

    Here's the revised query:

    WITH got_last_start AS

    (

    SELECT id, log_type_flg, log_dttm

    LAST_VALUE (CASE

    WHEN log_type_flg = "STRT".

    THEN log_dttm

    END

    IGNORES NULL VALUES

    ) OVER (PARTITION BY id - can - be

    ORDER BY log_dttm

    ) AS last_start

    OF log_table_x

    )

    SELECT id, log_type_flg, log_dttm

    , (log_dttm - last_start) * 24 * 60 elapsed

    , SUM (log_dttm - last_start) OVER (PARTITION BY ID.

    ORDER BY log_dttm

    ) * 24 * 60 AS total_elapsed

    OF got_last_start

    WHERE log_type_flg IN ("CMPT", "PAUS")

    ORDER BY id, log_dttm

    ;

    Output of your sample data:

    ID LOG_ ELAPSED TOTAL_ELAPSED LOG_DTTM

    -------------- ---- ------------------- -------- -------------

    1111 PAUS 09-26 - 2013:09:09:58.17.17

    1111 CMPT 09-26 - 2013:10:09:58 1.00.83

    2222 CMPT 09-26 - 2013:12:09:58 180.00 180.00

    3333 CMPT 09-26 - 2013:10:09:42 59.73 59.73

    In Oracle, when you subtract one DATE from another DATE, the result is the NUMBER of days between them.  In the above query, I multiplied the past columns and total_elapsed by the number of minutes per day (24 * 60), to show the time in minutes.

  • How does the index start and end in the reference Word text VI to a word document?

    How a correlation between the index values start and end to a position or coordinate in a Word document?

    Is it a type of lookup table that will refer to a value of say '35' (to start) to a line or a particular character of the position in a Word document? There is nothing in LV help which explains nothing other than the value '-1 '.

    Hey, JayB,.

    The start and end of the Text.vi in Format Word values are the positions of the characters in the document. The values start at 0 on the first (or ASCII character such as a space, tab, or carriage return) and for each character (or the ASCII character). So for example if I wanted to "BOLD" the word "carrots" in the list below, where the values start at 0 on the word 'grocery store '.

    Grocery store:

    Apples

    Black berries

    Carrots

    Detergent

    Then I would enter a start 33 and the end of the 40s, making sure to count the ramasseherbe returns and spaces.

    I hope this helps.

    Logan H

  • Time of start and end elements

    Hey there,
    I have an application where I need two elements of time. I can hard code the data once and use a Select list, but this link below by Daniel McGhan is the way to go. Does anyone know how to access this code for the start and end time the elements? The article does not list how this is possible, but I can have over looked something... not sure. Thank you for reading this Thread.
    http://apex.shellprompt.net/pls/apex/f?p=566:4:198609458994020::NO:::

    Hello:

    Now sure to know how this was done, but it seems as likely javascript.

    There is a very cool JQuery Timepicker that I really like and in fact for a really nice interface:

    http://Haineault.com/Media/jQuery/UI-timepickr/page/

    Kind regards

    Bruce

  • How to calculate average daily time of the Start_Time and End_Time fields

    I am using ORACLE 11 G on Red Hat Linux, I have calculated the average daily time of multiple transactions for each day. The followign is the querry that shows the difference between the fields end_time start_ time and time.

    Select TRIP_LOAD_STARTED AS START_TIME, TRIP_LOAD_ENDED'RE END_TIME.

    ceil ((TRIP_LOAD_EDDT-TRIP_LOAD_STDT) * 1440) "time difference Bw Start and End.
    of GATE2GATE_ACTIVITY_VW
    Where TRIP_LOAD_STARTED > = February 1, 14 '
    AND TRIP_LOAD_ENDED < 3 February 14 '
    ORDER BY TRIP_LOAD_STARTED;

    The querry above gives me the result as follows:

    Start_Time End_Time time Diff bw begins and ends

    1 FEBRUARY 14 FEBRUARY 1, 14 18

    1 FEBRUARY 14 FEBRUARY 1, 14 18

    1 FEBRUARY 14 FEBRUARY 1, 14 18

    1 FEBRUARY 14 FEBRUARY 1, 14 18

    1 FEBRUARY 14 FEBRUARY 1, 14 18

    1 FEBRUARY 14 FEBRUARY 1, 14 18

    1 FEBRUARY 14 FEBRUARY 1, 14 12

    FEBRUARY 2, 14 2 FEBRUARY 14 29

    FEBRUARY 2, 14 2 FEBRUARY 14 29

    FEBRUARY 2, 14 2 FEBRUARY 14 29

    FEBRUARY 2, 14 2 FEBRUARY 14 29

    FEBRUARY 2 FEBRUARY 2, 14 14 19

    FEBRUARY 2 FEBRUARY 2, 14 14 19

    FEBRUARY 2 FEBRUARY 2, 14 14 19


    It shows two dates for which I want to get the average duration in minutes for each group to date by the start time.


    I use the following querry that probably gives me the average two days mentioned in where clause


    Select the floor (avg ((TRIP_LOAD_STARTED-TRIP_LOAD_ENDED) * 1440)) 'average of Minutes of time.

    of gate2gate_activity_vw

    Where TRIP_LOAD_STDT > = February 1, 14 '

    AND TRIP_LOAD_STDT < 3 February 14 ';

    Average duration in Minutes

    29

    Can someone help me to a daily average time calculated between start and end.

    Kind regards

    mhamidch

    Is that what you want:

    SELECT trunc (TRIP_LOAD_STARTED), trunc (TRIP_LOAD_ENDED).

    floor (avg (ceil ((TRIP_LOAD_ENDED-TRIP_LOAD_STARTED) * 1440))) Diff

    OF GATE2GATE_ACTIVITY_VW

    WHERE TRIP_LOAD_STARTED > = to_date('01/FEB/2014','dd/MON-YYYY')

    AND TRIP_LOAD_ENDED<>

    Trunc GROUP (TRIP_LOAD_STARTED), trunc (TRIP_LOAD_ENDED)

    Always the example of create table and insert statements to verify the results and use the to_date with date format function.

    Post edited by: Elya

Maybe you are looking for