need to recover the previous registration with the current record

Hi all

I have a table like,
ID, name, date_de_modification, prev_loc

1, 'ABC', March 23, 2009, "A1".
2, "XYZ", March 23, 2009, "C1".
3, "KLM", March 23, 2009, "C1".
4, '012', March 23, 2009, "C1".
5, '1231', March 23, 2009, "C1".
6, "XYZ", March 23, 2009, "C1".
7, '435', March 23, 2009, "C1".
8, "homeless", March 28, 2009, "C1".
9, 'Bad', March 27, 2009, "C1".
10, 'ABC', March 29, 2009, "B1".
11, "345df", March 29, 2009, "C1".
12, 'ABC', March 29, 2009, "C1".

Requirement:
for 'ABC', there is 3 files. at the top is id 12. with this record I want view prev 'ABC' with id 10 folder, then
record with id 10 I want to display folder prev 'ABC' with the id 1 as wise...

I want o/p as:

12, 'ABC', MARCH 29, 2009, C1, B1
10, 'ABC', MARCH 29, 2009, B1, A1
1, 'ABC', March 29, 2009, A1, null

Kind regards
Krishna Prasad

Published by: user9933144 on April 29, 2009 02:11

Hello, something like:

WITH tab AS (
SELECT 1 ID, 'ABC' name , TO_DATE('23-March-2009', 'DD-MON-YYYY') date_modified, 'A1' prev_loc FROM DUAL UNION ALL
SELECT 2, 'XYZ' , TO_DATE('23-March-2009', 'DD-MON-YYYY'), 'C1' FROM DUAL UNION ALL
SELECT 3, 'KLM' , TO_DATE('23-March-2009', 'DD-MON-YYYY'), 'C1' FROM DUAL UNION ALL
SELECT 4, '012' , TO_DATE('23-March-2009', 'DD-MON-YYYY'), 'C1' FROM DUAL UNION ALL
SELECT 5, '1231' , TO_DATE('23-March-2009', 'DD-MON-YYYY'), 'C1' FROM DUAL UNION ALL
SELECT 6, 'XYZ' , TO_DATE('23-March-2009', 'DD-MON-YYYY'), 'C1' FROM DUAL UNION ALL
SELECT 7, '435' , TO_DATE('23-March-2009', 'DD-MON-YYYY'), 'C1' FROM DUAL UNION ALL
SELECT 8, 'sdf' , TO_DATE('28-March-2009', 'DD-MON-YYYY'), 'C1' FROM DUAL UNION ALL
SELECT 9, 'gdfg' , TO_DATE('27-March-2009', 'DD-MON-YYYY'), 'C1' FROM DUAL UNION ALL
SELECT 10, 'ABC' , TO_DATE('29-March-2009', 'DD-MON-YYYY'), 'B1' FROM DUAL UNION ALL
SELECT 11, '345df',TO_DATE('29-March-2009', 'DD-MON-YYYY'), 'C1' FROM DUAL UNION ALL
SELECT 12, 'ABC' , TO_DATE('29-March-2009', 'DD-MON-YYYY'), 'C1' FROM DUAL)
-- End of test data
SELECT Id, name, date_modified, prev_loc,
          LAG(prev_loc) OVER (PARTITION BY name ORDER BY id) prev_prev_loc
 FROM tab;

         ID NAME  DATE_MODI PR PR
--------- ----- --------- -- --
         4 012   23-MAR-09 C1
         5 1231  23-MAR-09 C1
        11 345df 29-MAR-09 C1
         7 435   23-MAR-09 C1
         1 ABC   23-MAR-09 A1
        10 ABC   29-MAR-09 B1 A1
        12 ABC   29-MAR-09 C1 B1
         3 KLM   23-MAR-09 C1
         2 XYZ   23-MAR-09 C1
         6 XYZ   23-MAR-09 C1 C1
         9 gdfg  27-MAR-09 C1
         8 sdf   28-MAR-09 C1

Published by: Seanmacgc on April 29, 2009 02:36

Tags: Database

Similar Questions

  • I need to recover the BIOS of Satellite A200 - 1 M 7

    Hello

    I need to recover the bios of my toshiba. can someone tell me how to do?
    I can do it with usb floopy?
    Should what program I?

    Help, please

    Hello

    I'm afraid I n t m know what you want to do?
    You want to update the BIOS?
    Could you please send more details?

    The BIOS is focused on victory. This means that the BIOS can be updated only running Windows OS.

  • Pavilion g6: customer loses power on password and I need to recover the laptop - Pavilion g6

    customer lost power on password and I need to recover the laptop - Pavilion g6

    The disabled return code is = 63078592

    Hello

    Come in:

    72950514

    Concerning

  • Could not initialize and I need to recover the data on the hard drive.

    Original title: computer MOM will not start and I need to recover the data on the hard drive.

    It's an old computer and I do not know what version of Windows it was running.  I guess I need a bootdisk of exploitation, but where can I download that?  Or would it be easier to pull and make a secondary drive in my computer that I just replaced?  It works under Windows XP.

    Hello

    If the old system does not start could be the hard drive. Put the hard drive in another computer as a 2nd drive and then access the files. If you use a computer XP, Vista or Windows 7, you should be able to access the files, unless the drive has failed.

    You can save your files by putting the drive in another computer as a 2nd drive (better) or a USB external drive case and then save up to removable media such as CD, DVD or other USB drives. Of course a real store of the computer or the manufacturer of your system can help to recover the files.

    Or you can use a boot Ubuntu CD to back up data. (This will not work if the hard disk is defective or other issues preventing the system from booting from the CD/DVD drive.)

    Use Ubuntu Live CD to backup files from your Windows computer dead
    http://www.howtogeek.com/HOWTO/Windows-Vista/use-Ubuntu-Live-CD-to-backup-files-from-your-dead-Windows-computer

    I hope this helps.
    --------------------------------------------------------------------------------------------
    Rob Brown - Microsoft MVP<- profile="" -="" windows="" and="" devices="" for="" it :="" bicycle="" -="" mark="" twain="" said="" it="">

  • I need to change the MX records.

    Hello

    I made a website for a client in muse and that he already had a domain Gandi.NET

    Now, I used the DNS to put the site online, but I need to change the MX records in business from adobe to use their mail.

    He says I have to gandi MX records in the zone file. I have no idea where is the file of zone or how I can change it.

    It looks like this.

    @ 10800 IN MX 10 spool.mail.gandi.net.

    @ 10800 IN MX 50 fb.mail.gandi.net.

    Can someone tell me where I can add this? I tried to add a new MX record.

    Thank you!

    Hello

    Please join chat support team, and they will help you with this.

    Let me know if you have any question.

  • Need to set the attribute of the current record based on the value of the next record

    With the help of forms 6, I have a form that displays the list of folders. There may be multiple records with the same ID, but with different expiration dates. I need set attributes for hilite only the record with the latest expiration date. The current list points of interest reviews of future expiration dates - but we found that, sometimes, the subscription is renewed before the expiration date has been reached, causing two records with the same ID with expiry dates in the future.

    I can (and do) sort the records by date of expiry and the identification for the record with the latest expiration date is always the last to this ID, so what I want to do is to check the next record to see whether or not it has a different ID. If the current record is the last expiration date, & must be hilited. Because I might want to hilite the current record, I can't simply navigate to another record, according to the description I found, what makes the next_record builtin. Anyone know how I can check for a value in the next record without making the current record?

    Thank you.

    What I would do:

    -Create a DB view based on your table and including the function call DRIVE as a separate column.
    -Base that block you on this point of view
    -If the block is modifiable, set the DML target for the block to your database table.

  • move to the current record after query execution

    Hi all

    I have a form where I can list all the jobs of the db that can start or stop.

    For more details, form has columns jobs, the current situation of db, action (drop-down start/stop)

    The user will see list of works on the screen and it goes directly at a check-in and departure (submit) work using drop-down for this record.

    Once they start and stop work, run query goes off to show the current state of employment.

    Now goes to my requirement, after the query is run, I want to go to the (employment) record that the user has begun the work.

    Currently, the cursor goes to the first record.

    Is there any oracle 10g AS property where I can get the current record, put it in setting and go to this record after having run query?

    Is there another way?

    Kind regards
    Leonard

    Hello

    If you are sure that the record after motion will keep the same position, you can before, store the current record in a variable number with Get_Block_Property (CURRENT_RECORD) integrated, then after query, use Go_Record() with the variable number stored in the parameter.

    If you think that, after re - question registration number can change, you need to browse your recordings in a loop, then stop navidation while you find the corresponding key.

    François

  • BlackBerry Smartphones the current record access denied on synchronization

    I have an 8330 with OS 4.3. When I try to synchronize with MS Outlook 2007 address book and calendar, I get the following message: "the current record access is denied. Validate your permission to access the folder.

    How do I do that?

    Hello

    Knowledge Base:

    http://www.BlackBerry.com/BTSC/articles/510/KB14749_f.SAL_Public.html

    Please let me know if it helps!

  • APP-COMPENSATION-07092: this action is not valid for the current record.

    Cannot access panel assignments used to updates within oracle HR receive this error message. How to solve this problem.

    Please see these documents.

    APP-COMPENSATION-07092 this action is not valid for the current record by trying to access assignment [813815.1 ID]
    PERWSHRG APP-COMPENSATION-07092 when you navigate to assignments [796523.1 ID] screen
    PERWSHRG APP-COMPENSATION-07092 trying to access assignment [ID 1434212.1]
    PERWSEAC cannot enter costs for the Contingent Workers APP-PAY-07092 [1458000.1 ID]
    App-pay - 07092:Action not valid for registration: current salary for the potential asset Asg [ID 360168.1]
    Method of payment when opening errors: APP-COMPENSATION-07092: this process is not valid for the current record. [ID 289691.1

    Thank you
    Hussein

  • How to get the current record in a block?

    Hello

    How can I get the registration of a block, but the current record of the records displayed by this block? (for example if the number of records is 50, but the number of displayed records is 10, I want to get the current_record from the 10, not all 50).
    the: system.current_record returns the current all-time record

    Thank you

    You can use a combination of: SYSTEM. CURSOR_RECORD which returns the current record and GET_BLOCK_PROPERTY ('BLOCK', TOP_RECORD), which returns the number of the record that is displayed as the first visible record, your result should be something like

    :SYSTEM.CURSOR_RECORD-GET_BLOCK_PROPERTY('BLOCK', TOP_RECORD)+1;
    
  • Developer Mode error: outdated., the xxAM.xxVO1 view object contained no trace. The records displayed may have been deleted, or the current record of the view object is not properly initialized.

    Hi all

    I'm creating a Maunal search page.

    To do this, I created a view based on a custom display object.

    Page contains 2 parameters.

    If I give all settings and click the OK button.

    It gives the following error.

    Developer Mode error: outdated data


    This page contains outdated information. This error could have been caused by the use of the buttons of the browser (the browser back button, for example). If the browser navigation buttons were not used, this error may result from coding errors in the application code. Please check press the back button on the browser developer guide - view primary key object comparison section to review the main cause of this error and correct the mistakes of coding.


    Cause:
    The view BLTrinDisplayAM.ViewVO1 object did not contain any record. The records displayed may have been deleted, or the current record of the view object is not properly initialized.

    To visit, please click on the Home link at the top of the application page to return to the main menu. Next, go to this page using the app's navigation controls (menu, links and so on) rather than use the controls of the browser as rear or front.

    If I don't give any parameter and click go Button.The content of the view are displayed.

    So if I pass all parameters and click Go, then the corresponding record is displayed.

    Why, for the first time, if I give the parameter and click Go, obsolete data error is coming?

    Please help me.

    Grateful for your help!

    -Aren

    You use the object of the view for the search criteria and search results fields.

    I suggest you to remove references of VO fields of search criteria, item1 and item2.

    And in the event of the button 'Go' in the processFormRequest, get the criteria for field values entered by the user as below and run the object (ViewVO1) of the view by using these values.

    String buCode = pageContext.getParameter ("item1");

    String lsiCode = pageContext.getParameter ("item2");

    Thank you

  • disable the current record...

    How to disable the current record in the table?

    My tables 5 records. If my cursor in the first record, I would like to make some calculations and disable it (current record) but other text fields (4 documents) should be the mode.

    I used set_item_property it disable all records...

    How to do this?

    Thank you...

    Published by: skud on July 15, 2011 18:36

    Use set_item_instance_property instead of set_item_property and disable insert and update enabled property of all points for example blocks

    If: system.cursor_record = '1' then
    set_item_instance_property ('TEXT_ITEM1', current_record, insert_allowed, property_off);
    set_item_instance_property ('TEXT_ITEM1', current_record, update_allowed, property_off);
    set_item_instance_property ('TEXT_ITEM1', current_record, NAVIGABLE, property_off);
    end if;

  • Need to recover the old code of previous email address

    I bought my software in 2013 and wiped my computer today and I now cannot re download because I graduate from high school a year ago so no more have access to the email that gave me the code. I can provide my my current University student card and my ID school where I studied previously. I just need the software as soon as possible because I start my photography degree tomorrow and I did not have my computer would be cleaned of all its software. Please let me know if you can help me!

    You will need to contact the Adobe Support via chat. You will need to provide proof of purchase, I'm afraid.

    Contact the customer service

    Available at the time United States.

  • I need to recover the password for AOL from my iPhone 6

    I need to enter the password for my AOL on my Mac account. The password works on my iPhone6. How can I get to use on my MAC? At the moment, I can only access my email via my phone.

    You can not, you must retrieve it from AOL.

  • I need to recover the old Claris works docs but do not have Pages Open Office does not work?

    I need to recover an old Claris for Yosemite books

    You can try LibreOffice. He is able to open some of these old formats.

  • Lost recovery key and need to retrieve the current data

    Yes.

    It's a really bad situation.
    In order to regain sync I have to generate a new recovery key
    But the recovery key generator will mangle the data synchronized.

    Is it possible to recover the data?

    I was not able to sync with Firefox on Android and a few days ago my hard drive gives up so I had to reinstall windows.

    It is amazing that nobody reads the entire post.

    "I was not able to sync with Firefox on Android and a few days ago my hard drive gives up so I had to reinstall windows."

    Where was the big warning sign when I joined firefox sync?.

    Thanks for a useless service. Now, I have a lot of passwords to reset...

Maybe you are looking for