How to divide the Dates

Hi all...

Here, I use the following scripts...

create table a10 (eno number, date f, date t, number of sal)

INSERT IN A10 (ENO, F, T, SAL) VALUES)

1, TO_Date (1 July 2013 12:00:00 AM ',' DD/MM/YYYY HH: mi: SS AM'), TO_Date (June 30, 2014 12:00 ',' DD/MM/YYYY HH: mi: SS AM')

(100);

INSERT IN A10 (ENO, F, T, SAL) VALUES)

1, TO_Date (May 1, 2013 12:00:00 AM ',' DD/MM/YYYY HH: mi: SS AM'), TO_Date (April 30, 2014 12:00 ',' DD/MM/YYYY HH: mi: SS AM')

(200);

COMMIT;

entry:

ENO      F             T                SAL

07/01/2013 2014/06/30 100 1

1 05/01/2013 30/04/2014 200

Expected results:

ENO FTSAL

1 05/01/2013 2013/06/30 200

1 30/04/2014 300 07/01/2013

1 05/01/2014 2014/06/30 100

I'm little bit confused how to divide the dates here... Any help is appreciated.

Thank you all

Stéphane

Hello

Always tell what version of Oracle you are using, especially if it's so old.

In Oracle 10 (or 9, by the way) you can do this way:

WITH cntr AS

(

SELECT LEVEL AS n

OF the double

CONNECT BY LEVEL<=>

)

got_change_date AS

(

SELECT d.eno

C.n

WHEN 1 THEN f

ANOTHER t + 1

END AS change_date

C.n

WHEN 1 THEN 1

OF ANOTHER-1

END as mul

sal

BY a10 d

CROSS JOIN cntr c

-WHERE... - If you need any filtering, put it here

)

got_total_sal AS

(

SELECT eno

change_date f

Advance (change_date) OVER (PARTITION BY eno

ORDER BY change_date

) - 1 AS t

SUM (sal * mul) over (PARTITION BY eno

ORDER BY change_date

) AS total_sal

OF got_change_date

)

SELECT *.

OF got_total_sal

WHERE t IS NOT NULL

ORDER BY eno, f

;

Tags: Database

Similar Questions

  • 1 source of eBS - 2 planning targets - how to divide the data?

    Hello

    I use FDM ERPI to load the data of the eBS in Hyperion Planning (eBS 11.5 and EMP 11.1.2.1).

    I have load data in planning of 2 databases (which are in the same application of planning), target adapters so 2 and two locations.

    The two locations have the same source and the same mapping.

    But some accounts must go to app1, while others must go to app2.

    But no information in gl on the target application.

    How could I do?

    The EPMA table or source file to see what plan enter each account is used?

    And when I should exclude accounts: in the import action? in the exportToDat?

    Thanks in advance for your halp, hoping it's clear...

    Fanny

    Fanny,

    If you will be cutting back, you will need to make separate FDM apps for each target card - it is the only way. FDM creates the drill by definition based on the "installation Code", as some call the default adapter. There cannot be an adapter by default, so to drill at work, it can be a card in the application.

    Until the FDM/Oracle solves this problem, you should not use multiple cards in one drill active FDM app.

    Kind regards
    Robb Salzmann

  • How to divide the data in the column based identifier

    Hello

    I use the oracle database.
    I have data in this format in my column 1234 ~ 2345 ~ 3456 ~ 4567.

    I need a motion to split the data in the column based on the identifier ' ~', so that I can choose the value after the second occurrence of the identifier.


    Do I know who can do this.

    Published by: 962987 on October 3, 2012 12:11

    Hello

    Welcome to the forum!

    Whenever you have any questions, please post CREATE TABLE and INSERT statements for some examples of data and the results desired from these data. For example, in view of these data

    CREATE TABLE     table_x
    (       my_column     VARCHAR2 (40)
    );
    
    INSERT INTO table_x (my_column) VALUES ('1234~2345~3456~4567');
    INSERT INTO table_x (my_column) VALUES ('just~2 parts');
    

    I think you're asking for these results

    PART_3     MY_COLUMN
    ---------- ----------------------------------------
    3456       1234~2345~3456~4567
               just~2 parts
    

    I suppose that, if the string does not contain at least 2 ' ~ s, you want to return null. It's a good idea to explain what you want like that for special cases and include examples in your sample data and results.

    Not all versions of Oracle are exactly the same. In fact, they are all different. If you want the best solution that works with your version, then say what version it is.
    The following query will work in Oracle 10.1 and higher:

    SELECT  REGEXP_SUBSTR ( my_column
                    , '[^~]+'
                    , 1
                    , 3     -- 3rd occurrence (after 2nd delimiter)
                    )     AS part_3
    ,     my_column          -- if wanted
    FROM    table_x
    ;
    

    See the FAQ forum {message identifier: = 9360002}

    Published by: Frank Kulash, October 3, 2012 15:24
    Adding sample data and results.

  • How to divide the column Date OBIEE

    Hello
    We have the name of the date column: To_Date and the format is DD/MM/YY hh.
    How to divide the date in YEARS, MONTHS, DAY as new columns.
    kindly help on that.


    Kind regards.
    CHR

    Published by: 867932 on November 23, 2011 22:18

    Hi user,

    All 3 functions can be written in RPD too. MDB layer, duplicate the date column-> the mapping tab to column of Goto-> expression-> functions Builder Select-> calendar Date functions / hour-> select DayofMOnth function. The column of your logic formula will look like,

    DayofMonth (YourDateColumn)

    Rgds,
    DpKa

  • Anyone know how to check the date of warranty until when?

    Anyone know how to check the date of warranty until when?

    https://checkcoverage.Apple.com/Jo/en/;JSESSIONID=9pJ0X9pFPJtNg3c44yDGCvk9pVpt5l QSgn4B60y4Skv1WfmnqMkF!-1840326800

  • How to find the date item was my favorites on Mozilla Firefox

    on system moot bookmark how to find the date of the bookmark?

    In bookmarks menu select organize bookmarks to open the bookmarks library. In the bookmarks library, click views, and then display the columns and then added. This will display a column showing when a bookmark has been added.

  • How to set the date and time on my HP Officejet pro 8600 more?

    How to set the date and time on my HP officejet pro 8600 more?  It just on a printed journal Jan-oo-oo fax shows 00:00 AM.  There are no instructions on how to change this.  I need proof that I sent a fax to a certain date and time.  Help, please.  Thank you

    Hello

    Below are the steps to set the Date and time for your device:

    1. On the Control Panel, press the right arrow key ( ), press Setup ( ).

  • Camileo S20 - How to display the date and time

    Hi, all. I got as Christmas present the Camileo S20, and I am not able to view the date and time in the video. In the manual is no reference on this subject, only how to set the date and time. But what is the intention to set the date and time in the camera, if it is not possible to display video?

    Hello

    Have you checked the user manual of your TV cam?

    If it of possible to display the data and the time you can find in your user manual how to do this. It always interesting to read ;) s

  • How to reset the data counter without resetting the phone

    How to reset the data counter each month so that I can control my data counter with our reset the phone (or) without using factory data reset.

    Thanks for the reply much appreciated.

    Parameters

    Data Manager

    Press the lower left key

    Reset the data counter

  • How to save the data in table 1 d to Excel in continuous

    Mr President.

    How to save the data in table 1 d to Excel at all times, so that all the data of the first scan must be placed first thought and all the data from the second analysis must be placed on the second Board and continue on the street...

    Sy@m...

    Hi Sy@m

    Here is a vi that might give you a few ideas to try:

  • How to read the date and time of a file by labview information

    How to read the date and time of a file by labview information? for example, time created and updated time.

    The similar question had already spoken here (this is the old thread but still seems topical):

    http://forums.NI.com/T5/LabVIEW/file-date-created/TD-p/109836

  • How to analyze the data of the cDAQ and Signal Express, especially after analysis?

    In the first series of tests of my instrument, it took longer than expected for the race.  Thus, the data was saved in 6 days.  The file is too large for export to Excel.  At the beginning of the project, I was as ignorant as I could go ahead and add analysis and the scaling of measures.  By the scaling, I mean my data of switching current dew points or whatever it is that I record.

    How to evolve the data to read the output data as expected 4mA = point of dew of-20 C or 0 PSIG?  Can I pre program this to be recognized for each event?

    For real analysis I am doing – I would first analyze the data I recorded and choose different points to send to Excel to graph and analyze.  Is this possible?

    Secondly, I would like to know how to scale and analyze my data in the project without having to do this later analysis in the future?

    I have a cDAQ-9172 with LabVIEW signal Express 3.0 that uses four modules - 9211 2 modules of thermocouple, my 4-20 1-9201 module +/-10V module and 1-9203.

    Thank you for any assistance.

    Hi Patricia,

    "' You can do this by adding a step Load/Save signals ' analog '.  I hope this helps!

  • How to set the Date and time on a remote target in Measurement &amp; Automation Explorer (MAX)?

    Hello

    I'm trying to follow the steps described in the following link:

    How to set the Date and time on a remote target in Measurement & Automation Explorer (MAX)?

    It is said

    The software on the target currently supports only the time zoneand deletes the old files?

    I need set the date and time

    and remove all the old unwanted files

    the calendar was gray does not allow me to change the current date.

    Anyone know how to change

    Hi all!

    According to this the below Knowledge Base article, Remote Configuration System Support must be installed on the target for time settings to change in MAX.

    http://digital.NI.com/public.nsf/allkb/FAB0EC4D6E5EE0F386257738005733A3?OpenDocument&MeTC=max_MAXDat...

    If you don't know what version of the system supported remote Configuration software that you have installed on your device target, it is likely that it is not yet installed. Add this software by clicking below your target to the MAX software option and selecting "Add/Remove Software". This is where you will install the System Configuration Remote Support software.

    Please let us know if you have any questions!

  • all my data is all save on the local disk c, how to share the data with the other drive, local drive d.

    all my data records on the local disk c, how to share the data with the other drive, local drive d.

    Hi Jasonbichard,

    1. what type of drive is D? Is - this another partition on the same disk?

    2 Windows operating system you are using?

    You can change the location of the disk to save the data in the d: instead of C: and check if it helps.

    a. navigate to the location (username) C:\Users\.
    b. right click on the folder that you want to change the location, and then select Properties.
    c. click on the location tab and change the location to D: drive.

    d. click on apply and Ok.

  • Multiple column trees: how to access the data in columns? There is a bug?

    Hello

    I have a strange problem. I use tree column multi like this:

    In this case, I have the tree column and two other custom columns.

    Now, how to access the data in the SECOND column?

    We can write all the data in a row thanks the EditElementTree:AddElement:ChildText, because it is an array of strings.

    However, when I want to read the data, I use ActiveCelltring, meaning that a SINGLE string and not a string table oO (so I only have the value of the first column and never others.

    So, I can do what I want? Is this a bug?

    Thank you very much

    R0b1n

    OK, I have the solution.

    We play with the ActiveColumnNumber attribute, to read the values of different...

    I left the message, it may be useful for later someboby

    R0b1n

Maybe you are looking for

  • Qosmio - How can I create a bootable DVD of OS?

    Hello-----Please help me I have a laptop Toshiba Qosmio with Microsoft Windows Vista Ultimate. The DVD of the operating system was attached with the laptop, but now I've lost him.But I have the files that was in the original DVDBut I don't know how t

  • My Mac has stopped at random to send and receive text messages. Any thoughts?

    My Macbook Air stopped randomly send and receive text messages today. All software are up to date on my Mac and iPhone, and transfer of text messages is on my iPhone. Don't know what to do!

  • Search table for 0 or 1 throughout the course of

    Hello. I have a column of data with 530 000 lines. The only values are a 0 or a 1 (1 represents the occurrence of an event; 0 does not work). I would like to be able to determine the amount of 0 seconds between each consecutive occurrence of 1 throug

  • Chicony usb 2.0 camera does not work when it is turned on

    During opening camera or Windows Live help software (Toshiba), the camera that is built into my laptop does not work. In Windows Live Messenger, when I try to make a video call, Windows Live Messenger stops. When I open the camera the camera assist s

  • Resolution graphics ATI T500 problems

    I'm having a problem with the graphic part my switchable graphics ATI in my T500. I am using an external monitor and when I use the integrated graphics card intel 'energy saver' the monitor has no display what is on my laptop screen, and it can go to