calculate the length of stay in each Department

Create table flow_tbl
(order_id number
, from_dep varchar2(100)
, to_department varchar2(100)
, date_sent date);

insert into flow_tbl
values (234, 'store', 'lab', '01-jan-14');

insert into flow_tbl
values (234, 'lab', 'QC', '02-jan-14');

insert into flow_tbl
values (234, 'QC', 'front desk', '02-jan-14');

insert into flow_tbl
values (235, 'store', 'front desk', '02-jan-14');

insert into flow_tbl
values (236, 'store', 'QC', '03-jan-14');

insert into flow_tbl
values (236, 'QC', 'front desk', '05-jan-14');

commit;











I have above data for an order when it has been sent from one Department to the other.

I would like to recover the time during which an order has been in a Department before a transfer to another Department.

For example, order 234 is since laboratory Department time = January 2, 14 - 1 January 14

Can someone help me please on how I can retrieve the duration for each order by Department?

Thank you

Diana

Looks like, you probably want to then:

Select order_id,

from_dep,

to_department,

date_sent - lag (date_sent) lifetime (order_id date_sent order partition),

date_sent

of flow_tbl

order by order_id

date_sent

But I expect there to be a '1' for the QC online store?

Tags: Database

Similar Questions

  • Calculate the length of the lines of text

    In a script, I'm inserting text which is a 4 line poem. Each line except the last ends with a hard return ('\n'). I would like to calculate the length (in inches or in another unit of length) of each individual line to find the longest line and adjust the left indent accordingly. Is it possible to get the length of a line of text in a script?

    Thank you!

    A return is \r

    \n is a soft return

    Take a look through the comments here

    http://InDesignSecrets.com/setting-poetry-flush-left-Center-on-longest-line.php

  • How to calculate the length of the video format (seconds)

    Hello

    I use the ActionScript 3.0 CookBook book and it shows how to calculate the length of a video (and also playing the video in progress) in seconds using the property at the time of the NetStream class.

    So, for example, the length of my video is 1070 seconds.

    But I want to be able to convert a format such as ' 00 (hours): 00 (mins): 00 (dry) ", '1070 seconds' how can I get this?

    Any help is appreciated!

    TA :)

    Kind regards
    M.

    Hi, thanks for the reply :) you have helped me understand the following code which I just found (and that seemed to work the way I needed it).

    Quote:

    If (_duration > 0 & _stream.time > 0)
    {
    _playbackTime.text = generateTime (_stream.time);
    }

    function generateTime(nCurrentTime:Number):String
    {
    var nMinutes:String = (Math.floor(nCurrentTime / 60)< 10="" "0"="" :="" "")="" +="" math.floor(ncurrenttime="">
    var nSeconds:String = (Math.floor (nCurrentTime % 60)< 10="" "0"="" :="" "")="" +="" math.floor(ncurrenttime="" %="">

    Result set
    var sResult:String = nMinutes + ":" + nSecondes;

    Return value
    return sResultat;
    }

  • Calculate the length of the median line of the polygon

    How to convert the polygon to the central axis to calculate its length?

    I assume that you are not after the length of the bounday of a polygon, but the length of a median line after its construction of a polygon?

    Oracle 11 g 2 has no such ability. He can do it in 12 c but no one knows what's next for this version, in space.

    I was contacted several times on the implementation of an algorithm of centerline for my Oracle Spatial to 4 Companion (SC4O) the software free. It is possible that this example of wikipedia shows:

    https://Commons.wikimedia.org/wiki/file:Medial_axis_example_2d.svg

    But I am not prepared to implement such an algorithm without actuals) 1 and 2) some kind of inducement.

    concerning
    Simon

  • How to find the length of a certain number in labview?

    Hi all

    I am Pramod in Bangalore.

    I need to know is all their VI which calculates the length of a number.

    For example, for the number 1000, length is 4. Same I need is calculated automatically in VI, instead of manually.

    Kind regards

    Pramod M G

    If the number is in a control or the indicator, you can do it like this:

  • Calculate the number of fringes

    Is anyone know the feasibility of the use of the Machine Vision or LabView to calculate the number of fringes in each region? (Attached image). I want to count how many white line on each region. For example, on the attached picture, there are about 6 regions and each region will display the number of the white line in their own region. For information, I have V8.5 of LabView and NI Vision Assistant V8.5. Please, give me some ideas on how to solve it.

    Thank you.

    Farid

    Check this box

  • Get the length and width of a rectangle

    I use sdo_sam.tiiled_bins in rectangles of bursting into different sections. I need to divide the rectangle along the x axis depending on if there is longer or wider. I checked the documentation and I couldn't find a way to get the length and width of a rectangle encompassing minimum. Is there any built-in feature to get the length and width of a rectangle or do I have to create my own? Database is 11 GR 2.

    Thank you
    Rob

    Rob,

    You can use SDO_GEOM. SDO_MIN_MBR_ORDINATE and SDO_GEOM. SDO_MAX_MBR_ORDINATE to calculate the length and width of a mbr.

    References:

    [SDO_GEOM. SDO_MIN_MBR_ORDINATE | http://docs.Oracle.com/CD/E11882_01/AppDev.112/e11830/sdo_objgeom.htm#i866250]

    [SDO_GEOM. SDO_MAX_MBR_ORDINATE | http://docs.Oracle.com/CD/E11882_01/AppDev.112/e11830/sdo_objgeom.htm#i866249]

    Kind regards
    Noel

  • find the length of the string

    Hi all

    I have a srting that contains two or more channels as for instance, it's my channel (think of this total string as one string) "Bronson, Ms. Jamie", "elder, Ms. Francis '.
    Now I want to calculate the length of the string of replacement of commas and apostrophes with null.

    Can someone pls help me with this?

    Thank you
    SQL>
      1  with t as (
      2   select '''Bronson, Ms. Jamie'',''Elder, Mrs. Francis''' as mystring
      3  from dual)
      4  select * from t;
    
    MYSTRING
    ------------------------------------------
    'Bronson, Ms. Jamie','Elder, Mrs. Francis'  
    
    SQL>
      1  with t as (
      2   select '''Bronson, Ms. Jamie'',''Elder, Mrs. Francis''' as mystring
      3  from dual)
      4  select replace(replace(mystring, ',', null), '''', null) from t;
    
    REPLACE(REPLACE(MYSTRING,',',NULL),
    -----------------------------------
    Bronson Ms. JamieElder Mrs. Francis
    
    SQL> l
      1  with t as (
      2   select '''Bronson, Ms. Jamie'',''Elder, Mrs. Francis''' as mystring
      3  from dual)
      4  select length(replace(replace(mystring, ',', null), '''', null)) as string_len from t;
    
    STRING_LEN
    ----------
            35  
    
  • measure the length of a path in Illustrator

    Hello

    I work in laser cutting, and very often I need to know how much time is the way I'm going to print with the machine. It is very useful to know the length (and area) of each path directly while you design in Illustrator.

    How can I get this information in Illustrator CS6?

    Thank you all

    Michele

    Length of the journey.

    Select the path.

    Window > Document Information >-drop down menu-object

  • How to find the length of curves?

    Help me please!
    I need to find a length of curves in clip placed on stage. It is not created by a script drawing. At least, I need to find our association to the properties of the points and controllers of curves in order to calculate the length. It is even beter than just length.

    In other words, it there is no way to access the properties by using the functions of AS3 and even layout of the Flash editor? I think it's a way to work in future versions of AS and flash.

    Thanks for the replies.

  • How the page break to each Department and calculate totals for Department

    I have a stored procedure that queries our sql database and returns the name of the employee, their Department, and a few other calculations. I use CFDocument to create a table and view the results. Here's the code that does this (see below) what I have to do is find a way to create a page break after that I have show a total for each column in each Department. My questions are so

    1. How can I insert a page break after the end of each service
    2. just above the page break, how to calculate the totals for the Department and display them?

    < cfdocument format = "pdf" >
    < table width = "650" border = "1" >
    < cfoutput query = "getResults" >
    < b >
    < td > #EmpName # < table >
    < td > #Dept # < table >
    < td > #JobType # < table >
    < td > #NonBill # < table >
    < td > #NonBillMeter # < table >
    < td > #NumberFormat ((NonBillPercent*100),.00) # < table >
    < td > #Bill # < table >
    < td > #BillMeter # < table >
    < td > #NumberFormat ((BillPercent*100),.00) # < table >
    < /tr >
    < / cfoutput >
    < /table >
    < / cfdocument >

    If I remember correctly, the tag you want is cfdocumentitem. Also, you want to check the attribute of cfoutput group.

    The details are in the cfml reference manual. If you do not have one, has the internet.

  • Microsoft Movie Maker - cannot change the length of each clip.

    Cannot change the length of each clip on Microsoft Movie Maker.

    I clicked on 'tools', then 'options' in Microsoft Movie Maker after importing my media and organize my clips as the way I would like it. When I then click on the "Advanced" tab, image duration shows only 5 seconds with the transition period only 1.25 seconds, which is the default setting and that is also what I want. However, when I play my project in Movie Maker, it accelerates through each clip. I also noticed that when I press the title of 'Clip' in my headings at the top left and then click on 'Properties', the duration of each clip shows that only 00:02 seconds. Which is why my speed clips too quickly.

    I would have thought that setting my time of duration in the Tools section would then set in the Clips section, but this is obniously does not. I don't understand why everyone would show differently and wonder if you can help me to slow down the speed that my movie is playing.

    Thank you

    Cannot change the length of each clip on Microsoft Movie Maker.

    I clicked on 'tools', then 'options' in Microsoft Movie Maker after importing my media and organize my clips as the way I would like it. When I then click on the "Advanced" tab, image duration shows only 5 seconds with the transition period only 1.25 seconds, which is the default setting and that is also what I want. However, when I play my project in Movie Maker, it accelerates through each clip. I also noticed that when I press the title of 'Clip' in my headings at the top left and then click on 'Properties', the duration of each clip shows that only 00:02 seconds. Which is why my speed clips too quickly.

    I would have thought that setting my time of duration in the Tools section would then set in the Clips section, but this is obniously does not. I don't understand why everyone would show differently and wonder if you can help me to slow down the speed that my movie is playing.

    Thank you

    ================================
    The change of setting to: Tools / Options /.
    Advanced... tab applies only to the added clips
    to the timeline * after * you change the setting.

    If you switch to view "Storyboard" and select
    all of the clips as a batch (select one and the type...
    CTRL + A)... you can add the 'Speed Up, Double.
    or "Slow down, half" effect of changing the
    duration. Simply select all clips / right click
    the effect on the menu... Choose...
    Add to storyboard table.

    'Speed Up, Double' cuts the duration of half.

    "Slow Down, half ' double life.

    These effects can be added up to six times.

    If you need finer adjustment...
    the info may be useful:

    You can change the duration for each clip
    manually. Move your pointer autour the
    edge of an element until you see a double red
    arrow. Now, drag the double red arrow...
    you will see if show a ToolTip displays the duration
    train to change.

    Or... just to redo the project after changing
    the long-term: Tools / Options / Advanced
    tab.
    Volunteer - MS - MVP - Digital Media Experience J - Notice_This is not tech support_I'm volunteer - Solutions that work for me may not work for you - * proceed at your own risk *.

  • Calculate the size of fonts depends on each device

    Hello everyone

    Anyone know how to calculate the size of font suitable for each device? the 8100 and 8300 look fine but to 8900 look small the same font size (18px), so I'm looking for something, a setting to help me calculate control font size.

    the screen resolution is a possible cause, how do you know this and use it for this proposal?

    Thanks in advance

    Greetings

    Don't use pixels when you ask the police - use points.

  • update of the commission of 6 percent of the employees in each Department, who got less pay

    How to upgrade add 6% commission to the salary of the employee in each Department, which received less pay

    Vinodh

    ora_1978 wrote:

    create table emp (number of eno, ename varchar2 (20), number of salary, number of dno);

    Insert into emp values(1,'john',1000,10);

    Insert into emp values(2,'smith',2000,10);

    Insert into emp values(3,'bill',5000,20);

    Insert into emp values(4,'mary',6000,20);

    Insert into emp values(5,'charles',1500,20);

    Insert into emp values(4,'mary',2000,30);

    Insert into emp values(4,'patrick',4500,30);

    create table dept (number of dno, dname varchar2 (10));

    Insert into dept values(10, 'HR');

    Insert into dept values(20, 'IT');

    Insert into dept values(30, 'ADMIN');

    How to add 6% commission to the salary of the employee table in each Department, which received less pay

    for example in the emp table for the dno 20 salary charles should get updated at 1500 * 1.6

    Vinodh

    Assuming that the two last emp records have 6 and 7 of Brian eno (and not 4 as you have your copy and paste error)...

    You can identify the records with the minimum in each Department as...

    SQL > ed
    A written file afiedt.buf

    1 Select keep (dense_rank of first order of salary) of the min (eno) as min_eno
    2 of t_emp
    3 * Group of dno
    SQL > /.
    MIN_ENO
    ----------
    1
    5
    6

    3 selected lines.

  • Helps to find employees in each Department with pay the lowest

    If I use the from employees of a hr schema table. I want to find the last_name, salary and employee department_id for employees with min (salary) for each Department

    EMPLOYEES / / DESC:

    ame                               Null               Type

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

    EMPLOYEE_ID NOT NULL NUMBER (6)

    FIRST NAME VARCHAR2 (20)

    LAST_NAME NOT NULL VARCHAR2 (25)

    EMAIL NOT NULL VARCHAR2 (25)

    PHONE_NUMBER VARCHAR2 (20)

    HIRE_DATE NOT NULL DATE

    JOB_ID NOT NULL VARCHAR2 (10)

    SALARY NUMBER (8.2)

    COMMISSION_PCT NUMBER (2.2)

    MANAGER_ID NUMBER (6)

    DEPARTMENT_ID NUMBER 4

    Here's what I used

    Select last_name, salary, department_id from employee

    where wages (select min (salary) of the Group of employees by department_id)

    order by department_id;

    However, it gives me the employees in each Department with a min wage equal to ANY min wage, even from other departments.

    Just please give me a suggestion on this rewrite?

    Hello

    2776946 wrote:

    ... Here's what I used

    Select last_name, salary, department_id from employee

    where wages (select min (salary) of the Group of employees by department_id)

    order by department_id;

    ...

    You have diagnosed the problem exactly!  It is not enough to see if the wage of the employees table corresponds to a salary of the subquery; you need to check if the salary and the department_id both match.  Then change the subquery to return the salary both the department_id and compare the two, like this:

    SELECT name, salary, department_id

    Employees

    WHERE () salary, department_id) )

    SELECT MIN (salary)

    department_id

    Employees

    GROUP BY department_id

    )

    ORDER BY department_id;

    Apart from formatting, parts in Redare the only changes from what you have posted.

Maybe you are looking for

  • How to find config editor in Firefox windows 8

    I want to block the download of pictures during the navigation. (WINDOWS 8, FIREFOX 40) I have been suggested to go to config editor and permissions.default.image. But i can not find it.

  • Satellite Pro P200 (PSPB7E) - where to find the new display drivers?

    Laptop bought in July 2007, the Windows Vista Business operating system.Vista windows update immediately so don't know not if the following problem was there before I updated. When put in a slideshow for all images almost immediately a blue screen ap

  • What are the capabilities of the boot camp?

    I am deciding if I should a new macbook pro and I was wondering what were the boot camp capabilities. For example, I would be able to download and run programs like Microsoft Office for Windows 10 using boot camp?

  • How to unlock a vi that is password protected?

    We have a VI that I went from version 7.x to 2009SP1. I need to add a few items troubleshotting to the façade. The problem is that the VI is password protected, and no one remembers the password, just possible passwords. What are my options? Thank yo

  • How to find the ratio between the two frequencies in the fft

    Hi, I'm Jean, I need to find the ratio of the frequencies of 1st and 2nd graph fft. Already, I received information of this site only. Mr. Alten helped me. Now, I have to continue the same problem and need to find the ratio of the frequencies. Please