Request to remove old records

Hello

Please help me to write this query.

I have a table with the structure and data.

{code}

create the table temp_table1

(

change_number varchar2 (100 CHAR),

Description varchar2 (200 CHAR)

)

{code}

{code}

insert into temp_table1 values ('7218', "LIST MAT.");

insert into temp_table1 values ('7218', "LIST MAT.");

insert into temp_table1 values ('7218', 'Spec. POLLUTANTS OTTICA MANUALE");

insert into temp_table1 values ('7218', "PLM");

insert into temp_table1 values ('7218', "PLM");

insert into temp_table1 values ('' 7218', A PLM");

insert into temp_table1 values ('' 7218', PLM B");

insert into temp_table1 values '7218', 'PLM C;

insert into temp_table1 values ('7218', 'THE SCHEME');

insert into temp_table1 values ('7218', "DIAGRAMMA DI VENTILES");

insert into temp_table1 values ('7218', 'the standard DI COLLAUDO');

insert into temp_table1 values ('' 7218,' WHEREAS UNIVERSITY");

insert into temp_table1 values (' 7218 ', ' DI VAT REGISTRATION standard.) ALSTOM EXP-EAST-STD-005');

insert into temp_table1 values ('7218', "the standard DI INTALLATION");

insert into temp_table1 values ('7218', 'the standard DI LAVORAZIONE');

insert into temp_table1 values ('7218', 'the standard DI VERNICIATURA');

insert into temp_table1 values ('7218', "MODULO DI VALIDAZIONE VERNICIATURA");

insert into temp_table1 values (' 7218 ', ' the standard COSTR.) NOTE DI RATIOS ');

insert into temp_table1 values ('' 7218', TOPOGRAFICO C.T.");

insert into temp_table1 values ('' 7218', TOPOGRAFICO L.S.");

insert into temp_table1 values ('7218', 'TOPOGRAFICO + NOTE DI RATIOS');

insert into temp_table1 values ('7994', "LIST MAT.");

insert into temp_table1 values ('7994', "PLM");

insert into temp_table1 values ('7994', "PLM");

insert into temp_table1 values ('7994', "PLM");

insert into temp_table1 values ('7994', 'THE SCHEME');

insert into temp_table1 values ('7994', 'the standard DI LAVORAZIONE');

insert into temp_table1 values (' 7994 ', ' the standard COSTR.) NOTE DI RATIOS ');

insert into temp_table1 values ('' 7994', TOPOGRAFICO C.T.");

insert into temp_table1 values ('7994', 'TOPOGRAFICO + NOTE DI RATIOS');

insert into temp_table1 values ('8305', "PLM DI CHANGES");

{code}

I want to delete old records that have been added the previous changes, excluding recordings whose description starts with "PLM."

For ex: change number 7994 exists with description 'TOPOGRAFICO + NOTE DI RATIOS', that had added to change 7219, which should be deleted. Latest album should stay exist.

Output would be like that.

{code}

insert into temp_table1 values ('7218', 'Spec. POLLUTANTS OTTICA MANUALE");

insert into temp_table1 values ('7218', "PLM");

insert into temp_table1 values ('7218', "PLM");

insert into temp_table1 values ('' 7218', A PLM");

insert into temp_table1 values ('' 7218', PLM B");

insert into temp_table1 values '7218', 'PLM C;

insert into temp_table1 values ('7218', "DIAGRAMMA DI VENTILES");

insert into temp_table1 values ('7218', 'the standard DI COLLAUDO');

insert into temp_table1 values ('' 7218,' WHEREAS UNIVERSITY");

insert into temp_table1 values (' 7218 ', ' DI VAT REGISTRATION standard.) ALSTOM EXP-EAST-STD-005');

insert into temp_table1 values ('7218', "the standard DI INTALLATION");

insert into temp_table1 values ('7218', 'the standard DI VERNICIATURA');

insert into temp_table1 values ('7218', "MODULO DI VALIDAZIONE VERNICIATURA");

insert into temp_table1 values ('' 7218', TOPOGRAFICO L.S.");

insert into temp_table1 values ('7994', "LIST MAT.");

insert into temp_table1 values ('7994', "PLM");

insert into temp_table1 values ('7994', "PLM");

insert into temp_table1 values ('7994', "PLM");

insert into temp_table1 values ('7994', 'THE SCHEME');

insert into temp_table1 values ('7994', 'the standard DI LAVORAZIONE');

insert into temp_table1 values (' 7994 ', ' the standard COSTR.) NOTE DI RATIOS ');

insert into temp_table1 values ('' 7994', TOPOGRAFICO C.T.");

insert into temp_table1 values ('7994', 'TOPOGRAFICO + NOTE DI RATIOS');

insert into temp_table1 values ('8305', "PLM DI CHANGES");

{code}

delete temp_table1

where rowid in)

with t as)

Select the rowid RID.

ROW_NUMBER() over (partition by order of description by change_number desc) rn

of temp_table1 t

)

Select rid

t

where not)

RN = 1

or

Description = "PLM."

)

)

/

7 deleted rows.

Scott@SOL12 >

SY.

Tags: Database

Similar Questions

  • I want to remove old record

    Hello

    I'm trying to delete records before 2013.

    delete reports where rep_date < 16/01/13;

    My table:

    SQL > desc reports

    Name                                      Null?    Type

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

    REP_ID NOT NULL NUMBER (5)

    SL_ID                                              NUMBER(2)

    REP_DATE TIMESTAMP (0)

    SOURCE VARCHAR2 (3200)

    SECTION VARCHAR2 (3200)

    REPORT                                             CLOB

    SQL >

    Please notify

    Thank you in anticipation

    The research of this?

    delete

    reports

    where rep_date< to_timestamp('01-jan-2013="" 00:00:00.000000',="" 'dd-mon-yyyy="">

  • How we remove the old recording files in ES2?

    Hello

    The error:

    2010-02-26 16:25:16, 811 ERROR [STDERR] 26 February 2010 16:25:16 com.adobe.idp.auditworkflow.dsc.service.storage.ProcessRecordingStorageImpl manageRecordingFileSizes
    ATTENTION: removal or the older recordings due to the limitation of space.

    I see above error several times in the log file. Then google, I had http://forums.adobe.com/thread/506674?tstart=0 wire. But I know this one.

    Is there any page in /AdminUI, where I can remove all the old record to a shot.

    Is there a way where I can improve the size of the buffer to the server?   Because sometimes I am getting error like below:

    2010-02-26 16:12:12, exceeding the threshold of memory WARN [com.adobe.idp.dsc.workmanager.workload.policy.MemoryPolicy] 558: maximum limit of 95.0, current value 106.0
    2010-02-26 16:12:12, 559 WARN [com.adobe.idp.dsc.workmanager.workload.policy.WorkPolicyEvaluationBackgroundTask] policies being violated since statistics on "adobejb_server1:wm_default". Cause: com.adobe.idp.dsc.workmanager.workload.policy.WorkPolicyViolationException: political work violated. Will try to get to 60000 ms

    Please help me!

    This is the help topic:

    http://help.Adobe.com/en_US/LiveCycle/9.0/workbenchHelp/000375.html#1548929

    Here's how to configure the number of recordings to keep:

    http://help.Adobe.com/en_US/LiveCycle/9.0/workbenchHelp/001482.html#1608026

    Scott

  • Can I get the contacts and email from an old record without using the Migration Wizard?

    Can I recover Contacts and messaging of an old record without using the Migration Wizard? Disc of the user in question has been very corrupted with several programs having a weird behavior. Migration wizard migrated corrupt files, so, even a clean install with only migrated users gave rise to an unusable installation.

    I have now all own installed now, but need old email files and contacts. How can I transfer this information a copy of the old/bad drive and only this info?

    Yes. With the old drive mounted and available, open Mail and choose import mailboxes... from the file menu of mail. In the dialog box import data from , choose Apple Mail.

    Navigate to the Mail folder to the user of the old library drive. According to the version of courier used, you might see folders named V2 and / or V3. Choose the applicable folder, and then click Choose.

  • How to find and remove old versions of Java on Mac OS.

    How can I find and remove old versions of Java on MAC Os?

    Via the Terminal check this https://www.java.com/en/download/help/mac_uninstall_java.xml

  • Hi there, I been using MacBook Air and IPad2 for awhile. Recently, I lost my MacBook Air and am interested open ICloud to check my folder/old records. Can I get directions to the opportunity to see my files in I have the cloud.

    Hi there, I been using MacBook Air and IPad2 for awhile. Recently, I lost my MacBook Air and am interested open ICloud to check my folder/old records. Can I get directions to the opportunity to see my files in I have the cloud.

    I hope that you are not in a surprise but a MacBook Air not backup to iCloud. It can record data in iCloud drive (if you saved it specifically to this place) and can synchronize Photos, Contacts, etc to iCloud if you had set it to do. You can use any computer and connect to https://www.icloud.com/ to see what is stored. I hope this is good news and that it contains what you hope.

  • Photos saving disk space to share images with your iPhoto or Aperture libraries.  Should which library I use to remove old photos?  If I delete old photos in iPhotos appear in pictures and vice versa?

    Should which library I use to remove old photos?  iPhoto or Photos?

    If you migrated a library iPhoto to Photos and you want to release the storage, you should remove the pictures of these two libraries.

    Related photos storage only comes out, after that the last linked file has been deleted.  If you do not use more of the iPhoto library, move it to a backup drive. Then simply delete the photos of your new photo library.

  • How to remove old VBAI calibrations?

    VBAI calbration increments, you can select data from previous calibration, or create a new set of calibration data, but there is no option to remove old, obsolete calibration data.

    How can this be accomplished?  Is there a directory where the old files can be deleted, or obsolete, confusing calibrations hault forever our vision computers?

    You can delete calibrations in system resources manager (Tools > System Resource Manager)

    Select the calibration files that you want to remove, and then click Remove. Note that multiple selection works.

    Hope this helps,

    Christophe

  • How can I remove old updates from windows to prevent their fill my hard drive?

    How can I remove old updates from windows to prevent their fill my hard drive?

    You don't want to. Otherwise, why would have installed their in the first place? They are updated for security. Thema alone.

  • Remove old programs in Java

    I need to remove old versions of Java prior to a function that requires that the most recent version will work correctly.  When I try to delete older versions of the Panel not give me the option to remove programs.  I am the administrator of my computer so don't understand why I can't delete old Java programs.  Clues as to how I can remove them?

    I am running XP with Service Pack 3.

    No Geek

    Thank you - was reluctant to download a product microsoft not by fear of screwing something else, but your message inspired me to go to the microsoft web page and search for help - found in trouble there and after two hours of observation fix it scan and fix problems in Java, I could uninstall and then get the new Java to work perfectly.

    No Geek

  • How to remove old files saved in Word pad

    How can I remove old files saved in Word Pad?

    Find where Wordpad stored the files on the disk.  The first place to look is in your Documents folder: click the Start button, and then click Documents . Boulder computer Maven
    Most Microsoft Valuable Professional

  • How to remove old files from backup under vista

    How can I delete old backup files?

    Hi AcieWorkman,
    Thanks for posting in the Microsoft community!
    I understand that you want to remove old backup files created using the Backup Wizard. Please correct me if I'm wrong.
    Please follow the steps under How can I delete a backup I created using the back up files Wizard?
    http://Windows.Microsoft.com/en-us/Windows-Vista/back-up-and-restore-frequently-asked-questions

    Please report if you are still having the problem. I will be happy to provide you with the additional options that you can use to get the problem resolved.
    We can't wait to hear back on your part.

  • How to remove old Services of FXM of the dashboard of the EU in the FMS

    How to remove old Services of FXM from edge of the EU in the FMS?

    We have removed the few services of FXM, but again, we can see that in the EU in FMS dashboard. Please suggest measures to clear those FMS.

    Hello

    End-users objects exist generally in the administration server > data management (note the fxm and fxv nodes)

    but they may exist in other places (according to what dashboard they appear on).

    The caution would be to open a support case and support check that right objects are deleted in the right place in the data tree.

    Hope this helps

    Golan

  • Can I remove old copies of Microsoft Visual C++ 2005 Redistributable?

    Can I remove old copies of Microsoft Visual C++ 2005 Redistributable - 648,0' where the entry ends in 'false '.

    moved to Virus & Malware

    Original title: Microsoft Visual C++

    What is "uninhjstall msoftware?"

    It's a Windows 7 computer or...?

    If you're referring to multiple instances of Microsoft Visual C++ 2005 ( 2008 or 2010) Redistributable listed in programs and features, do not delete one of them.

    • Remember the first rule of computers: If it is not broke, don't fix it!
  • I can´t remove old windows

    Frank. I tried to remove old windows as you sugested but the cleanmgr does not have the ability to clean this specific folder in my computer located on the C drive. It search the disc and just give a few other files such as temporary files, etc. The old windows file has 26 GB and it's as much space. What did I miss? Thank you.

    Have you tried simply delete? Seems too simple. However, I know that I got rid of my windows.old and did not use the cleanup utility. However, I may have just moved to an additional drive and Chantilly drive, don't remember the hand and cannot test since it has now disappeared.

Maybe you are looking for

  • Noise of rattling of Toshiba Rdxv60kb and no reaction

    I have one of these units combi bought a month ago. But now when I turn it on it on all three LED to VCR, DVD, HDD & light, dubbing LED will blink, and there is a clicking noise. There is not put on the screen and no response to the remote control. A

  • HP Pavilion 500 - 406 a: thinking of picking up a GTX 970

    I think now to pick up a GTX 970 for my 500-a 406, I think the mother board hold the card in the PCI Express x 16 card, I am correct in saying that? I also plan to upgrade the PSU for a Corsair VS550 as the current is not sufficient for the 970. Now

  • Goodbye, Atrix 4 G

    Bought a new HD Atrix and move on, I'm going to miss you all the... Can Matt or Mark, I get my profile corrected? I added the new device, connected to and plan to use the same MotoBlur account on the new device. Thanks in advance!

  • ThinkPad T43 1871-4AG

    Hello I know regarding the max resolution for this laptop is 1024 x 768. Is it possible to put it on 1280 x 1024. I tried the upgrade of drivers for graphics card and monitor. Any suggestions would be appreciated.

  • Director of Windows no longer works...

    Director of Windows has worked the first time I used it and I even did .avi with it, but now I can't get the clips to play inside the movie maker screen. WHY?