Latest EFFDT querying a field value has become the current value (not necessarily the FIRST / MIN)

I have a need to query the most recent entry in a value in a field became the current value, but it is possible that it was this value before, so a simple MIN() is insufficient.

Example, I want to date the EMPLID reported to the current REPORTS_TO

EMPLID REPORTS_TO EFFDT OTHER_DATA Comment
12345650050001/12/2010xxx
12345650050015/12/2010XYY
12345650099930/01/2013XYZ
12345650099930/06/2014zzz
12345650050015/01/2015ABCGET THIS EFFDT
12345650050001/12/2015nnn

Most of the time a MIN() would work, but there are cases like this that throw me a curve known.

Any advice is most appreciated. Thank you!

WITH emp_report_tab AS

(SELECT emplid 123456, 500500 reports_to, DATE ' 2010-12-01' effdate FROM dual)

UNION ALL

SELECT emplid 123456, 500500 reports_to, DATE ' 2010-12-15' effdate FROM dual

UNION ALL

SELECT emplid 123456, 500999 reports_to, DATE ' 2013-01-30' effdate FROM dual

UNION ALL

SELECT emplid 123456, 500999 reports_to, DATE ' 2014-06-30' effdate FROM dual

UNION ALL

SELECT emplid 123456, 500500 reports_to, DATE ' 2015-01-15' effdate FROM dual

UNION ALL

EmplID SELECT 123456, 500500 reports_to, DATE ' 2015-12-01' effdate FROM dual)

SELECT er0.emplid, MIN (er0.effdate)

Of emp_report_tab er0

WHERE er0.effdate >

(SELECT MAX (er1.effdate)

of emp_report_tab er1

where er1.emplid = er0.emplid

and er1.reports_to! =

(By SELECTING er2.reports_to in emp_report_tab er2

WHERE er2.emplid = er1.emplid

AND er2.effdate =

(select max (effdate) in emp_report_tab er3

where er3.emplid = er2.emplid

and er3.effdate<=>

GROUP BY er0.emplid;

EMPLID MIN (ER0. E

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

123456 15 JANUARY 2015

Tags: Database

Similar Questions

  • My Media Player 11 Vista has become corrupted and will not play mp3s. Where can I download Media Player 11 for Vista?

    My Media Player 11 Vista has become corrupted and will not play mp3s.

    Where can I download Vista Media Player 11? I've looked everywhere on the Microsoft Web site and the internet, and I can't find Media Player 11 for Vista.  I can find Media Player 11 for XP but not Vista.  What is happening with this?

    Or what should I do to solve this problem?  Thank you.

    Hi Person1948,

    You can try the K-Lite codec pack: http://download.cnet.com/K-Lite-Mega-Codec-Pack/3000-13632_4-10794603.html?tag=mncol

    For more information click here: http://social.answers.microsoft.com/Forums/en-US/vistamedia/thread/eb329d2e-0f70-4b27-81bd-bbdd64b0603a/

  • Question about a query that will be 1 for the first 10 lines, 2 for the

    Hi all

    I am trying to write a query that will be 1 for the first 10 lines, 2 for the next ten lines and so on.

    I tried several approaches such as mod, rank, case but could not get the correct idea.

    Grateful if someone can give me a hint on this one.

    Ex:

    Col1 Col2
    1 989
    1 120
    1 876
    2 121
    2 456
    2 87
    1 of 3
    3 22
    3 333
    ....................... and so on..


    Thank you
    MK.

    How about this:

    His past all my tests so far

    select trunc((rownum - mod(rownum-1,10))/10)+1
    from dual
    connect by level <= 1000
    
  • I have four e-mail accounts, but evil is at the top of the list. How to change things so that the fourth one can become the first?

    When I run Thunderbird, the same as that of my four accounts/E-mail addresses is always at the top of the list. However, over the years, I added three other e-mail addresses, and I would like the newest one is the default address at the top of the list. How can I change the order of the list so that my recenty added most e-mail address becomes the top of the list the default?

    Install this add-on.
    https://addons.Mozilla.org/en-us/Thunderbird/addon/manually-sort-folders/

  • Firefox displays wrong email address clickable on yahoo mail sign in field when I type the first letter. the Explorer it gets right.age

    When I type the first few letters in the sign in box on the Yahoo Mail sign in page via my Firefox browser last edition (Windows Vista) my clickable shows of Hotmail address in the drop-down list instead of my Yahoo address, (both begin with the same word.) so I then need always typing in my correct Yahoo address to connect. Internet Explorer gets this right, making me think it's a browser problem.

    I tried the settings in Yahoo and all in Firefox Tools/Options, I think. Thanks for any help!

    • Click on the (empty) input field on the web page to open the drop-down list
    • Select an entry in the drop-down list
    • Press the DELETE key (on a Mac: shift + delete) to remove it.

    You can also delete passwords that are stored here:

    • Tools > Options > Security: passwords: "saved passwords" > "show passwords".
  • SQL query client fetch that has all the products

    Hi all

    I need a SQL query to retrieve the output as shown

    Table: ACCOUNT_SUMMARY

    prod_id Cust_id

    101 AAA

    BBB 101

    101. THE CCC

    102 AAA

    103 AAA

    102. THE CCC

    : Table

    Prod_id Prod_desc

    101 Home_loan

    Vehicle loan 102

    Loan education 103

    Expected results:

    Cust_id Prod_desc

    AAA Home_loan

    AAA auto loan

    Educational ready AAA

    Sorry, could not understand your question clearly.

    Do you want this:

    WITH account_summary
                      AS (SELECT 101 prod_id,'AAA' cust_id FROM dual UNION ALL
                          SELECT 101,'BBB' FROM dual UNION ALL
                          SELECT 101,'CCC' FROM dual UNION ALL
                          SELECT 102,'AAA' FROM dual UNION ALL
                          SELECT 103,'AAA' FROM dual UNION ALL
                          SELECT 102,'CCC' FROM dual)
        ,Product
              AS (SELECT 101 prod_id,'Home_loan' prod_desc FROM dual UNION ALL
                  SELECT 102,'Vehicle loan' FROM dual UNION ALL
                  SELECT 103,'Educational Loan' FROM dual
                  )
      , acc_count
          AS  (SELECT prod_id, cust_id ,count(*) OVER (PARTITION BY cust_id) cnt
                FROM account_summary
                )
    SELECT A.prod_id,P.prod_desc
    FROM acc_count A, product P
    WHERE A.prod_id = P.prod_id
    AND  cnt = (SELECT count(*) FROM product)
    ORDER BY A.prod_id
    
  • My taskbar has become white and will not let me click on it

    It seems that the thing when it stops responding and turns white, I think that it maybe because he fired to white. If I freak out for it, the loading slider and I can't click anything. its White shot and I can't do anything and I think theres a problem. Please answer quickly

    Explorer is the question. Taskbar is part of the process explorer.exe only and it does not exist as a separate entity. Try the steps mentioned in my previous post about exploere.exe. If you cannot use the Task Manager, try the key combination to open the Task Manager: Ctrl + Shift + Esc.

    However, if you cannot use the Task Manager, try to clean boot (http://support.microsoft.com/kb/929135) and check.
  • CFLOOP query ti intrusion via cfmail missing the first attachment

    < cfquery name = "895" datasource = "85964" >
    SELECT name OF 568 WHERE ID = #ID #.
    < / cfquery >

    < cfloop query = '895' >
    < to = "" #form.email # intrusion via cfmail "from ="[email protected]"subject =" #form.subject # "" type = "html" > "
    #form.body # < cfoutput > < pre > < / pre > < / cfoutput >
    < cfoutput > < cfmailparam file = "" /45/ #name # "type =" application/pdf"/ > < / cfoutput >"
    < / intrusion via cfmail >
    < / cfloop >

    < cfdump var = "#pdf_list #" >

    It exports the names of files PDF 4 but it send on only 3 times all the missies first file

    Large.  Thanks for the update.

    If you have a chance, please mark this topic as replied.

  • PS CC becomes the default link for editing dynamic objects?

    I have LR5, more CS6 installed on my MacBook Pro.  I downloaded PS CC as a trial monthly and is now completed.  However, while I can "Edit in Photoshop CS6", now I can't edit photos using dynamic objects which connects directly to the CS6.  PS The CC has become the default program it seems and is the only option.  When I try to 'open as smart object' I am told that my CC PS license must be purchased.  Is the only way to fix this in out installation CC PS from my PC?

    Most likely, Yes, you will need to uninstall PS CC to get PS CS6 and LR to start to speak again at this level.

  • Fill with initial of the first name field?

    https://DL.dropbox.com/u/78503370/AFBS_IntakeAssesment_052912_STESTV3.PDF

    Hello! I'm only a graphics person, and I am just with simple scripts. I'm trying to shoot only the first initial of the PatientName_First field and have it fill in the PatientName_Initial field in the master page so that the initials of the patient will be displayed on each page of the form.

    Please do not die of laughing at my attempt to Frankenstein a script from another form in this one, I really know anything yet, but I'm learning. I was not yet able to make JavaScript work - had more success with FormCalc.

    I don't know if that's a problem, but the form must remain static. iPad can not yet read dynamic forms, and I must be compatible iPad.

    Thanks much for any help!

    Here you go:

    1. remove all the code in the event of 'change' for the PatientName_First field.  This event fires on each typed character, and in this case, you don't need to trap all the characters.

    2. Add the following code to the event "exit" to PatientName_First:

    If (this.rawValue! == null)

    this.rawValue = this.rawValue.replace(/^\s+|\s+$/g,""); "

    The foregoing will be trim spaces attack/flight of the first name field, which was what you expected and are a good idea.  Place in means of output event happen only once the user has finished typing the name and tabs out of the field.

    3. change the name of the subform that retains information name of 'PatientDemographics '.  Naming of the subforms in the hierarchy is recommended because it makes their SEO in the script easier.  See the screenshot below.

    4. Add the following code to the event of 'calculate' to the PatientName_Initial field in the master page:

    initial var = form1. PatientDemographics.PatientName_First.rawValue;

    If (initial! == null) {}

    If (initial.length > 0) {}

    this.rawValue = initial.substr (0, 1);

    }

    }

    When the name is in the main form, the calculate event fires and the script will be executed. The script will be the first name that was entered and set the initial field to the first character in the name.  Check the name = null is important because the calculate event fires when the form is opened first, before whatever it is entered.  We check to make sure there is at least one character in the first name field before trying out the first character.

    There is no need to use a dynamic form to do this, so it should work on an iPad.  Unfortunately, I can't test that.

    See you soon,.

    Kevin

  • Form field works only on the 2nd Page

    Hello

    I am building a form of a PDF file in Adobe LiveCycle Designer 8.0. It is a two-page form that has calculations on both pages. I try to get the amount of "TotalMilIncome" from the first page to reproduce on the second page. The amount of 'TotalMilIncome' field works fine on the first page. When I copy the same field in the second page I get this error message:

    errorLiveCycle.JPG

    In this error message can someone tell me what it is I am doing wrong? Thanks for your help in advance!

    When you work with multiple pages, the page identifier must be added before the name of the field. For example, "Page2.TotalMilIncom".

  • reload the page when SQL query returns a value

    Hello world

    the title of this discussion may seem strange, but I'll try to explain why I need this:

    A user has the ability to connect on my APEX application. There are several tabs in my application that are visible only if a certain SQL statement returns a value which is not the case by default. The user has also the ability to download a file that is transferred to an external system that analyzes the file and writes the data in the database. During this writing process - which may take several minutes - conditions for some of the tabs to show the will becomes real (-> the query will return a value). When the user refreshes the page manually, the tabs will be displayed. However, I want the tabs will appear automatically when the condition is met.

    Is it possible to refresh the page as soon as the query returns a value? It is perhaps possible to check it on the client side and trigger a refresh of the page when the condition is met. It would be even better if only the tabset has been updated, but refreshing the full page is fine as well.

    Thank you!

    Here is an overview of how it can be done

    This is possible thanks to a dynamic action being performed on a timer.

    View default tabs and dynamic action hide them on loading the page if they are not to be considered

    Create a dynamic action that will execute your query every 5 seconds or more

    If the query returns data, you can use the dynamic action to show your tabs using javascript

  • Calculates the treatment field values 1 step behind

    I have a very long form created in Acrobat Pro (latest version).

    To simplify the problem, this is what is happening.

    I have text boxes on a form and the user will enter quantity and price in each row for the materials and form will calculate to multiply these values and give you the total for each product and at the end, add all the totals giving you your total final.

    T1 * P1 = T1

    T1 + T2... T40 plus Total cost of material

    Which works very well.

    I then the user enter the estimate and below this breakthrough for what is the cost of labour, which is the cost of equipment, which is taxes, and then the rest is profit. The cost of the equipment is simply copied to the Total cost of the above materials.

    However, the calculation is made to simply take so I need percentages thus:

    The total cost of materials / estimate = percentage

    This grave 1 step walk behind. As in, it has not calculated the first go-around. You must enter a value elsewhere on the form or if I generate a button "Calculate" it will then deal with it. It's like if we take the old value before the field has been dynamically updated.

    Link to the PDF is below, if you fill in the Qs and Ps see the Ts fill fine.

    Below on the left turns is the estimate that you need to enter. In doing so, you will see the % for material cost and profit are bad, if you change a value anywhere on the form, you will see that they are then the value that was already there.

    I hope that makes sense for a person, the calculated values are 1 step behind and I need to understand why and get that fixed.

    Link to the PDF document

    Also, if I do these fields % under the shape number and 2 decimal places, I get an avalanche of mistakes whenever I enter a new value somewhere on the form I think because he's trying to divide by a number of vacuum which get a NaN error and gives me a pop up that it does not match the required format. How can I disable this error? I need to limit it to 2 decimal places, or 3 actually, but don't have a ton of errors popup whenever the user starts to fill the form.

    It's a problem of calculation of classic field command. You need to go to Tools - Forms - change - other tasks - defined field calculation order and whole list in the order in which calculations occur. So if a field is dependent on the value of the field B, then it must be lower than him in the list.

  • Firefox has becomes slow and unresponsive after that I tried to install the addons (not installed)?

    I recently format my computer and reinstall windows 7, since it was the only way I know of to solve the problem with Firefox (I already had this problem too). I download the latest version of firefox 33.0.2 and install it. This version was super fast. But becomes slow and unresponsive when I tried to install the Add-ons. I visited the official site of firefox and searching for addons, when I tried to install addons, Firefox crashed. Therefore, it has becomes quite slow and cannot restore previous sessions. Even to type my email address, it takes more than 5 minutes and reacts more frequently (after typing each letter).
    I want to know if this is due to some viruses, or this version of firefox is not "stable".

    Hey there,

    We are sorry to hear that Firefox crashes. To better help you, please follow the steps below to provide us with crash IDs to help us learn more about your accident.

    1. Enter Subject: hangs in the Firefox address bar and press ENTER. A list of submitted Crash reports will appear, similar to the one shown below.
    2. Copy the 5 most recent report ID begins with bp - and then back to your forum question but that stick in the box of "Post a response. (Please do not take a screenshot of your plant, just copy and paste the ID image below is just an example of what your Firefox screen should look like)

    Once you have done so, you could try the Firefox Safe Mode to see if the problem goes away. Firefox Safe mode is a troubleshooting mode that disables certain parameters, disables most Add-ons (extensions and themes).

    If Firefox is open, you can restart Firefox Safe mode in the Help menu:

    • In Firefox 29,0 and above, click on the menu button

      click Help

      then select restart with disabled modules.

    • In previous versions of Firefox, click on the Firefox button in the upper left of the Firefox window and click help (or click on help in the Menu bar, if you do not have a Firefox button) and click on restart with disabled modules.

    If Firefox is not running, you can start Firefox in Mode safe mode as follows:

    • On Windows: Hold down the SHIFT key when you open the desktop Firefox or shortcut in the start menu.
    • On Mac: Hold the option key during the startup of Firefox.
    • On Linux: Exit Firefox, go to your Terminal and run firefox-safe-mode
      (you may need to specify the installation path of Firefox for example/usr/lib/firefox)

    When the Firefox Safe Mode window appears, select "start mode safe."

    If the issue is not present in Firefox Safe Mode, your problem is probably caused by an extension, and you need to understand that one. Please follow the section Troubleshooting extensions, themes and problems of hardware acceleration to resolve common Firefox problems to find the cause.

    To exit safe mode of Firefox, simply close Firefox and wait a few seconds before you open Firefox for normal use again.

    I hope this helps!

    Curtis Parfitt-Ford
    Support for Mozilla

  • How to pass parameters/field values from one screen to another screen in blackberry

    Hi all

    I have two screens in my Application UI that is, login screen and continue the screen.

    Login screen has some fields of seizure as a user name and password and default language (French or English) for the application (Group of radio buttons).

    There is a button for the next who directs the user to another screen.

    This second screen has an input field. This input field is mandatory. The user can only go further if it is entered in this field of entry with valid values (i.e. numbers only).

    This screen has continue button so that the user can go further is on the next screen after you have entered a valid value in the field.

    Now, when the user clicks the continue button on the second screen so I have to validate the credentials of the user, he has provided in the first screen. Also, I need set the locale for the language he has provided to the login screen.

    So, to summarize.

    (1) user enters user name, password and language on the first screen. The user clicks NEXT and goes to the second screen.

    (2) on the second screen, the user enters a name click continuous. ((3) user credentials are validated, defined locale and user is illustrated below third screen).

    So, my question is how do I access username, the password, the language of the first screen in the second screen fieldChanged method?

    fieldChanged second display method will be called when user enter a value class we second screen and clicks continue.

    Please advice

    Thanks in advance...

    Store text values in the fields in your application class, and then pass it as a reference to each form or retrieve your instance of UiApplication and cast to the name of your class.

    public class MyApp extends UiApplication {   public String username;   public String password;   public String language;
    
    }...
    
    // Your first screen
    
    public class MyFirstScreen extends MainScreen {   private MyApp _app;
    
       public MyFirstScreen()   {      _app = (MyApp) UiApplication.getUiApplication();
    
          // Set your fields      // AS AN EXAMPLE, you can use:      // _app.username = field1.getText();      // _app.password = field2.getText();      // _app.language = field3.getText();   }}...
    
    // Your second screen somewhere
    
    public class MySecondScreen extends MainScreen {   private MyApp _app;
    
       public MySecondScreen()   {      _app = (MyApp) UiApplication.getUiApplication();
    
          // Access your fields      // you can use:      // _app.username      // _app.password      // _app.language   }}
    

    Now, this is one of the many ways to do it, but it works in its simplest form.

Maybe you are looking for