Identify the Start Date, based on other summary values.

I am runing:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 64 bit Production
PL/SQL Release 11.2.0.1.0 - Production

CORE11.2.0.1.0 Production

AMT for Linux: Version 11.2.0.1.0 - Production

NLSRTL Version 11.2.0.1.0 - Production

Here are the general dateset that I try.

with dateset as)
Select 1 worker, 8 totalhours, 27 April 15 ' work date, 1 installation, 35 production of all the double union
Select 1, 8, April 26, 15 ', 1, 35 of all the double union
Select 1, 0, 25 April 15 ', 1, 0 of all the double union
Select 1, 0, 24 April 15 ', 1, 0 of all the double union
Select 1, 6, 23 April 15 ', 1, 20 of all the double union
Select 1, 7, April 22, 15 ', 1, 27 union double all the
Select 2, 4, April 24, 15 ', 1, 15 union double all the
Select 2, 4, April 27, 15 ', 1, 15 union double all the
Select 2, 4, April 22, 15 ', 1, 15 union double all the
Select 3, 6, 26 April 15 ', 2, 32 union double all the
Select 3, 6, April 25, 15 ', 2, 32 union double all the
Select 3, 6, 24 April 15 ', 2, 32 union double all the
Select 3, 6, 22 April 15 ', 2, 32 union double all the
Select 3, 6, 23 April 15 ', 2, 32 double
)

Select
*
of dateset

I'm trying to get a date range or have the identified dates for the first harvest of the end date and then have hours max per each day added up to at least 15 hours and find the total production to examine these days that are.

So, if I choose the end date of April 25, 15 ', then I identified the maximum working hours at the facility. So because no work was allocated to the 25 for installation 1, 24 is the actual start date, in a plant worker 2 3 had 6 hours work, if installation date of end is the 25 hours max of 6. Noticed that the installation has 24, 23 and 22 total hours bing 17 (always meets the requirements of 15 hours), while the installation of 2 has 18 hours 25, 24, 23 (requirement for hours 15 min)

This is the prison of result data group.

with datasettwo like)
Select 4 maxhours, 24 April 15 ' work date, 1 installation, 15 totalproduction of all the double union
Select 6, April 23, 15 ', 1, 20 of all the double union
Select 7, April 22, 15 ', 1, 27 union double all the
Select 6, April 25, 15 ', 2, 32 union double all the
Select 6, April 24, 15 ', 2, 32 union double all the
Select 6, April 23, 15 ', 2, 32 double
)

Select
*
of datasettwo
order by
installation
date desc

so, how would I go about konwing when start work Date date has been reached because the total number of hours has been reached or excited the limit.

All thoughts.

With the help of everyone, thank you,

It's the rough solution I was looking for, could probably be cleaner.

I apologize for the confusion.

so, for April 27, the total production for that day for installation 1 is 50 units and 8 hours max.

and if the end date is sent to the 24

April 22 is the total output of 32 units and hours max of 6 for this day.

with dateset as)
Select 1 worker, 8 totalhours, 27 April 15 ' work date, 1 installation, 35 production of all the double union
Select 1, 8, April 26, 15 ', 1, 35 of all the double union
Select 1, 0, 25 April 15 ', 1, 0 of all the double union
Select 1, 0, 24 April 15 ', 1, 0 of all the double union
Select 1, 6, 23 April 15 ', 1, 20 of all the double union
Select 1, 7, April 22, 15 ', 1, 27 union double all the
Select 2, 4, April 24, 15 ', 1, 15 union double all the
Select 2, 4, April 27, 15 ', 1, 15 union double all the
Select 2, 4, April 22, 15 ', 1, 15 union double all the
Select 3, 6, 26 April 15 ', 2, 32 union double all the
Select 3, 6, April 25, 15 ', 2, 32 union double all the
Select 3, 6, 24 April 15 ', 2, 32 union double all the
Select 3, 6, 22 April 15 ', 2, 32 union double all the
Select 3, 6, April 27, 15 ', 2, 32 double
)

Select
installation
date of work
totalproductionperday
maxhoursperday
sum (maxhoursperday) on totalhours (installation partition)

from (select distinct)
installation
date of work
maxhoursperday
totalproductionperday
, case when sum (maxhoursperday) over (partition by order of ease by date desc)
-sum (maxhoursperday) over (partition by establishment, work date)<>
then 'Y '.
another "n".
end to_include
       
(select
installation
date of work
max (totalhours) maxhoursperday
sum (production) totalproductionperday
               
of dateset
                 
where date of work<= to_date(:enddate,="" 'dd-mon-rr')="" --="" end="" date="">
               
Group
installation
date of work
)
)

where to_include like 'Y '.

order by
installation
date desc

Tags: Database

Similar Questions

  • The autodeploiement based on the Start Date

    Hello world

    I have a requirement that I take a stream of HR (GTC FF) and this user from IOM and AD based on the start date of the provision. Without taking into account the start date, I can do it by assigning a role that contains an access strategy for AD. Under certain conditions, I attribute this role based on an attribute in the HR feed with a ruler, I defined.

    then how I also factor in the start date in the rule I created which determines if the role must be assigned. It does not resemble the rule designer can handle anything, except for string literals. If I can account for the date, I could probably use a scheduled task to later assign roles to users based on their start date. so in this process I assign the role if the two attribute condition and departure date are met.

    I could take a different approach and say I'm not going to assign the role to all through the accession of any rule and just manipulate through scheduled tasks. I'm not sure I like this approach, but if that's the solution preferred, please let me know.

    Thank you

    I suggest the route of the scheduled task. Recon in your current values, including the start date. Create an another UDF which is a checkbox, or a few true/false, yes/no field type. In your scheduled task, find users who have a start date< current="" time="" and="" then="" mark="" the="" udf="" as="" the="" true/yes/checked="" value.="" in="" your="" group="" membership="" rule="" for="" ad="" provisioning,="" add="" a="" rule="" that="" checks="" for="" this="" field.="" this="" will="" then="" trigger="" the="" access="" policy="" to="" apply.="" i="" have="" used="" this="" technique="" before="" and="" it="" works="" very="" well="" to="" turn="" a="" field="" that="" you="" can't="" have="" a="" group="" membership="" rule="" on="" turned="" into="" a="" field="" that="" can="" have="" a="" rule="">

    -Kevin

  • specify the start date of subscription plan?

    How can I specify the start date for a subscription to a plan (as the land line + mobile for the plan of Britain)? I would like to be covered for the month of September. I have to wait until September 1 before you subscribe and pay?

    Thank you

    Rob

    RobIreland wrote:

    I have to wait until September 1 before you subscribe and pay?

    Hello and welcome to the Skype community.

    Yes, you do.

    TIME ZONE - US EAST. LOCATION - PHILADELPHIA, PA, USA.

    I recommend that you always run the latest version of Skype: Windows & Mac

    If my advice helped to solve your problem, please mark it as a solution to help others.
    Please note that I usually do not respond to unsolicited private Messages. Thank you.

  • If you upgrade or change your plan, resets the start date?

    See the question above. I want to know if I upgrade/switch a plan, the start date of the subscription will be based on my initial contract or a new one?

    Not the start date is not reset. The payment date remains the same, the amount of charge are adjusted accordingly.

    Concerning

    Stéphane

  • Return max date records before the start date

    Hello

    Can anyone help please?

    I have two subqueries, a tableofchildren called, the other called tableofworkers. Tableofchildren identifies the date the child started a class.

    The second query, Tableofworkers, lists the workers and their history of involvement with the child. A child may have had a history with several workers. The worker has an allocatedstartdate indicating when they began to work with the child.

    For my purpose, I need to return the workername and the allocatedstartdate of the worker involved with the child more recently before or at the time when the child began the course.

    I have partially accomplished this with the query below. However, due to the quality of the data, the child may not always have an affected worker (allocatedstartdate) earlier or equal to the start date for the course of the child. In this case, the query fails and does not return the child record, that it excludes from the dataset.

    Can anyone suggest a way to modify this query, so it acts like a left outer query and returns all the records in the child and null raising where they have no worker allocated beginning before or on the date of start of course?

    Thank you! :)
    select *
     from
    (
    select tc.childid, 
    tc.childname, 
    tc.enteredcourse, 
    tw.workername, 
    tw.allocatedstartdate, 
    row_number() over ( partition by tc.childid, tc.enteredcourse order by tw.allocatedstartdate desc) rn
    from tableofchildren tc, tableofworkers tw
    where tc.childid = tw.childid(+)
    and tc.enteredcourse >= nvl(tw.allocatedstartdate,add_months(sysdate,-10000))
    )
    where rn = 1 
    desired output
    CHILDID CHILDNAME            ENTEREDCOURSEDATE         WORKERNAME           ALLOCATEDSTARTDATE        
    ------- -------------------- ------------------------- -------------------- ------------------------- 
    C1000   Johnny Rotten        01-APR-11                 Mrs Gerbil           19-AUG-10                 
    C1256   Doris Dingle         12-AUG-03                 Mrs Pepsi            12-AUG-03                 
    C3466   Bonny Boy            25-MAR-11                 Mrs Jones            23-FEB-11                 
    C4567   Casper Ghost         21-MAR-09                                                                
    C1245   Doris Dingle         20-NOV-06             
    create the table tableofchildren
    (ChildID varchar (6))
    ChildName varchar (20),
    Date of EnteredCourse,
    Date of LeftCourse);

    insert into tableofchildren (ChildName, EnteredCourse, ChildID, LeftCourse) values ("C1000", "Johnny Rotten', to_date (' 01/04/2011 ',' dd/mm/rrrr'), to_date (' 23/05/2011 ',' dd/mm/rrrr'));
    insert into tableofchildren (ChildName, EnteredCourse, ChildID, LeftCourse) values ('C1256', 'Doris Dingle', to_date (' 12/08/2003 ',' dd/mm/rrrr'), to_date (' 16/09/2005 ',' dd/mm/rrrr'));
    insert into tableofchildren (ChildName, EnteredCourse, ChildID, LeftCourse) values ('C3466","Bonny Boy', to_date (' 25/03/2011 ',' dd/mm/rrrr'), to_date (' 28/03/2011 ',' dd/mm/rrrr'));
    insert into tableofchildren (ChildName, EnteredCourse, ChildID, LeftCourse) values ('C4567', 'Ghost Casper', to_date (' 21/03/2009 ',' dd/mm/rrrr'), to_date('22/04/2010','dd/mm/rrrr'));
    insert into tableofchildren (ChildName, EnteredCourse, ChildID, LeftCourse) values ('C1245', 'Doris Dingle', to_date (' 20/11/2006 ',' dd/mm/rrrr'), to_date (' 30/12/2008 ',' dd/mm/rrrr'));


    create the table tableofworkers
    (WorkerID, varchar (6))
    WorkerName varchar (20),
    Date of AllocatedStartDate,
    Date of AllocatedEndDate,
    ChildID varchar (6));

    insert into tableofworkers (WorkerID, WorkerName, AllocatedStartDate, AllocatedEndDate, ChildID) values ('W3453', 'Ms. Whatever", to_date('12/05/2009','dd/mm/rrrr'), to_date ('2009-06-13', ' dd/mm/rrrr'),"C1000");
    insert into tableofworkers (WorkerID, WorkerName, AllocatedStartDate, AllocatedEndDate, ChildID) values ('W3442', 'Mr. Toad', to_date('14/07/2010','dd/mm/rrrr'), to_date (' 18/08/2010 ',' dd/mm/rrrr'), "C1000");
    insert into tableofworkers (WorkerID, WorkerName, AllocatedStartDate, AllocatedEndDate, ChildID) values ('W14592', "Mrs gerbil', to_date (' 08/19/2010 ',' dd/mm/rrrr'), NULL,"C1000");
    insert into tableofworkers (WorkerID, WorkerName, AllocatedStartDate, AllocatedEndDate, ChildID) values ('W3442', 'Ms. Pepsi", to_date('12/08/2003','dd/mm/rrrr'), to_date (' 22/04/2007 ',' dd/mm/rrrr'),"C1256");
    insert into tableofworkers (WorkerID, WorkerName, AllocatedStartDate, AllocatedEndDate, ChildID) values ('W3490', 'Mr. tomato' to_date('12/03/2008','dd/mm/rrrr'), to_date (' 04/30/2009 ',' dd/mm/rrrr'), "C3466");
    insert into tableofworkers (WorkerID, WorkerName, AllocatedStartDate, AllocatedEndDate, ChildID) values ('W3453', 'Ms. Whatever", to_date('01/06/2009','dd/mm/rrrr'), to_date ('2010-04-30', ' mm/dd/rrrr'),"C3466");
    insert into tableofworkers (WorkerID, WorkerName, AllocatedStartDate, AllocatedEndDate, ChildID) values ('W3457', "Mrs Jones", to_date('23/02/2011','dd/mm/rrrr'), null, "C3466");
    insert into tableofworkers (WorkerID, WorkerName, AllocatedStartDate, AllocatedEndDate, ChildID) values ('W3453', 'Ms. Jobsworth", to_date('22/11/2006','dd/mm/rrrr'), null, 'C1245');


    create the table OutputWanted
    (ChildID varchar (6))
    ChildName varchar (20),
    Date of EnteredCourseDate,
    WorkerName varchar (20),
    Date of AllocatedStartDate);

    insert into OutputWanted (ChildID ChildName, EnteredCourseDate, WorkerName, AllocatedStartDate) values ("C1000", "Johnny Rotten', to_date (' 01/04/2011 ',' dd/mm/rrrr'),"Mrs gerbil", to_date('19/08/2010','dd/mm/rrrr'));
    insert into OutputWanted (ChildID ChildName, EnteredCourseDate, WorkerName, AllocatedStartDate) values ('C1256', 'Doris Dingle', to_date (' 12/08/2003 ',' dd/mm/rrrr'), "Ms. Pepsi", to_date('12/08/2003','dd/mm/rrrr'));
    insert into OutputWanted (ChildID ChildName, EnteredCourseDate, WorkerName, AllocatedStartDate) values ('C3466","Bonny Boy', to_date (' 25/03/2011 ',' dd/mm/rrrr'), "Mrs. Jones", to_date('23/02/2011','dd/mm/rrrr'));
    insert into OutputWanted (ChildID ChildName, EnteredCourseDate, WorkerName, AllocatedStartDate) values ('C4567', 'Casper the ghost', to_date (' 21/03/2009 ',' dd/mm/rrrr'), null, null);
    insert into OutputWanted (ChildID ChildName, EnteredCourseDate, WorkerName, AllocatedStartDate) values ('C1245', 'Doris Dingle', to_date (' 20/11/2006 ',' dd/mm/rrrr'), null, null);

    Published by: little Penguin November 21, 2011 07:03

    What something like that?

    SELECT childid
         , childname
         , enteredcourse
         , workername
         , allocatedstartdate
    FROM
    (
         SELECT toc.childid
              , toc.childname
              , toc.enteredcourse
              , tow.workername
              , tow.allocatedstartdate
              , ROW_NUMBER() OVER (PARTITION BY toc.childid ORDER BY tow.allocatedstartdate DESC) AS rn
         FROM   tableofchildren   toc
         LEFT JOIN tableofworkers tow ON tow.childid = toc.childid
                         AND toc.enteredcourse >= tow.allocatedstartdate
    )
    WHERE rn = 1
    

    Just note that you need a different RANK and DENSE_RANK analytical ranking function if there is a chance that many workers could be attributed to the children on the same allocatedstartdate.

  • End date must CLEARLY not less than the start date, else it

    Hello

    I put DATE of BEGINNING of THE CONTRACT and END of CONTRACT fields on the form. These 2 objects (DateTime objjects), I pulled game tab of the palette and fell on my layout, fine design.

    Now, I try to put a validation than the end dat eshould not lower than the beginning, so I had a thread as below from Niall.

    http://forums.Adobe.com/message/1909551

    and I've done my coding FormCalc to the OUTPUT of the END DATE field as event title below,

    Please note that FormCalc
    End date must not less than the start date, else CLEAR-Begin

    var ACE
    var endDate

    As = xfa.resolveNode ("CUSTOMER..") RawValue Page31_Contracts.Con_Whole_Page.CON_Basic_Info.CON_START_DATE")
    endDate = xfa.resolveNode ("CUSTOMER. Page31_Contracts.Con_Whole_Page.CON_Basic_Info.CON_END_DATE") GLR awValue

    If (ACE > endDate) then
    xfa.host.messageBox ("end date is less than the departure date! End date is allowed")
    xfa.resolveNode (the "CUSTOMER". Page31_Contracts.Con_Whole_Page.CON_Basic_Info.CON_END_DATE") GLR awValue = null
    endif

    End date must not less than the start date, else CLEAR-end

    I tried to VALIDATE, calculate, change events of END DATE, but nothing works!

    Can pls. Let me Kow how I optimize my requirement? I'm anewbie,

    Thank you

    If you use the exit event, you will likely have the same code on the date fields beginning and end, because they have an addiction to each other. Maybe better try the validate end date event, so that if a field is changed the event is fired. You can try the following to validate the event

    // Pls. note this FormCalc
    // End date should not less than Start date, else CLEAR it - Begin
    
    var stDate
    var endDate
    
    stDate = CON_START_DATE.rawValue
    endDate = $.rawValue
    
    if ( HasValue(endDate) ) then
        if (stDate > endDate) then
            xfa.host.messageBox("End date is lower than Start date! End date is cleared")
            $.rawValue = null
        endif
    endif
    1
    // End date should not less than Start date, else CLEAR it - End
    
  • I have created a complete either form, with fields to interrogate.  When a test the form and enter the date in a field - it automatically inserts the SAME date in all other areas. How do fix you this?

    I created a form to fill in professional, with several fields.  When I try the form and enter data in a field - it fills the SAME data in all other fields.

    Give a unique name to each field.

  • Determine if the end date is after the start date

    I have 2 date fields in a form.  When I click the button submit, that I'm trying to ensure that the end date is after the start date.

    Here is the code I use:

    var sDate = Date.parse (BackgroundInformation.Background.CheckingDateStart.rawValue);

    var eDate = Date.parse (BackgroundInformation.Background.CheckingDateEnd.rawValue);

    xfa.host.messageBox ("Start Date:"+ BackgroundInformation.Background.CheckingDateStart.rawValue ");

    xfa.host.messageBox ("eDate: sDate" + eDate + ":" + sDate);

    if(sDate > eDate)

    {
    valid = false;
    fieldName += "Start Date is greater than the end Date."
    }

    The message box displays the start date 2014-10-30 but sDate is Nan.

    I tried:

    var eDate = new Date (BackgroundInformation.Background.CheckingDateEnd.rawValue);

    sDate var = new Date (BackgroundInformation.Background.CheckingDateStart.rawValue);

    and when I display sDate says 'Invalid Date '.

    Any ideas?

    It should work...

    var sDate = BackgroundInformation.Background.CheckingDateStart.value.date.value;

    var eDate = BackgroundInformation.Background.CheckingDateEnd.value.date.value;

    xfa.host.messageBox ("eDate: sDate" + eDate + ":" + sDate);

    if(sDate > eDate)

    {
       valid = false;
       fieldName += "Start Date is greater than the end Date."
    }
  • Access policy for the user whose status is "disabled until the start date.

    Hello

    By default political access does not work for the user whose start date is later in OIM 11 g. I have an access policy that the provisions of all users of Xellerate OID. This policy is not work for users who start date is later, i.e. status = disabled until the start date.

    No workaround to make the strategy work is much appreciated.



    Thank you
    GYAN

    up to 10g it work very well if you put provisining date as the current date. But, you cannot apply even in oim 11g

    Try below

    Add new udf to the user profile
    reconcile the start date in the new udf and leave the start of oim null date
    In this case the access policy will be triggers and you will be able to get an account created to the OID, and then set the start workflow OID IOM

    for reminder and all just to add trigger for the new udf and update on the changes.

    Note: In your case as OID in disable State it will cause no problem after the user status "disable up to that Start Date. If the resource object in activate State and change you the status to disable up to that starting date, it does not fire disable the user trigger.

    Kind regards
    Mireille nayan

  • the start date of the week formula

    Hi guys,.

    I have a report in which I need to display the Start Date of the week for a particular calendar date, for example

    Date week Start Date
    ---------- ---------------------------
    July 01, 2010 June 28, 2010
    July 2010 05 05 July, 2010
    11 July, 2010 05 July, 2010

    No idea how can achieve us.

    Thank you
    Ronnie

    TIMESTAMPADD (SQL_TSI_DAY, 2, TIMESTAMPADD (SQL_TSI_DAY, DAYOFWEEK (CURRENT_DATE) *-1, CURRENT_DATE))

  • Search based on the start date and end date

    Hello

    I added two fields "Start Date" and "End Date" on a search page.
    I did the VO extension also.
    Now, I have to implement the logic of the search to get all records created between' start' and 'End Date' after pressing the "GO" button on this page.

    Can someone please provide advice to extend the controller.

    Thanks in advance.


    Gaurav.

    I think that the path would be

    Import oracle.apps.per.common.webui.PerTransactionTopCOImpl;

    Thank you
    -Anil
    http://oracleanil.blogspot.com/

  • BlackBerry Z10 Z10 calendar Bug (closed schedule when you create a new appointment and try to change the start date/time)

    Hello

    Report a bug with my new Z10.  Fairly easy to reproduce:

    1. Go to "calendar".
    2. Click 'Add '.
    3. Click on the 'Starts' falling down
    4. Farm of "calendar".

    I tried to restart the phone, but same result.  This works if you change a date, but not to create a new appointment.

    Thank you

    Jamie

    This is a known problem and I hope it will be fixed in a future update.

  • What is the value of the start date, date in the end QueryAvailablePerfMetric method?

    The method QueryAvailablePerfMetric in the Performance Manager management entity has optional intervalId beginTime, endTime parameters.

    What is the difference in values returned by this method when the start and end dates are excluded?

    In my case, I see the same data.

    Because I do not think that same intervalId can we have different PerfMetricIds in a VMWare host, or is it not true?

    In the case of unmanaged ESX systems are provided only on statistics in real time for the current day.

    Statistics of sending hosts the vCenter Server system managing managed. The vCenter Server gathers statistics

    data performance of all systems ESX/ESXi that it manages and stores the information in its database, which constitute historical data.

    On the specification of begineTime and end in the spec would ensure only the metrics available in the specified period are gathered, if it makes a request for historical measures. These parameters will be not applicable for statistics in real time.

  • 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.

  • Select the last Date of multicolumn and its value adjustent cust_id

    I have a Table with 5 customer_id and 5 Dates with each belonging to its cust_id.

    I need to take the last, in my example would be CUSTID_5.  I know

    this with the GREATEST who select the CHANGE_DATE_5 (in my example), but

    How to choose the CUSTID_x? that goes along with the winning Date?

    create table test_tbl)

    number of custid_1

    date of change_date_1,

    number of custid_2

    date of change_date_2,

    number of custid_3

    date of change_date_3,

    number of custid_4

    date of change_date_4,

    number of custid_5

    date of change_date_5

    );

    INSERT INTO test_tbl

    (CUSTID_1, CHANGE_DATE_1, CUSTID_2, CHANGE_DATE_2, CUSTID_3, CHANGE_DATE_3, CUSTID_4, CHANGE_DATE_4, CUSTID_5, CHANGE_DATE_5)

    VALUES

    (111, sysdate, 222, sysdate + 1, 333, sysdate + 2, 444, sysdate + 3, 555, sysdate + 4);

    commit;

    Hello

    Here's one way:

    WITH unpivoted_data AS

    (

    SELECT custid, change_date

    , EVALUATE () OVER (ORDER BY change_date DESC) AS r_num

    OF test_tbl

    UNPIVOT ((custid, change_date)

    Label ((custid_1, change_date_1) AS 1)

    , (custid_2, change_date_2) AS 2

    , (custid_3, change_date_3) AS 3

    , (custid_4, change_date_4) AS 4

    , (custid_5, change_date_5) AS 5

    )

    )

    )

    SELECT custid, change_date

    Of unpivoted_data

    WHERE r_num = 1

    ;

    Having several columns for several occurrences of basically the same thing is a bad table.  This problem would be much simpler, but also more effective if each pair custid/change_date has been strored on a separate line.  In addition, you would not be limited to 5 pairs.

Maybe you are looking for