delete a duplicate

Hi friends,

I need to create a script to remove duplicates in the client database for records below...

call_no call_var group call_ser cname

2                   Y          1               28           fax

2                   Y          1               29           unit_1

2                   Y          1               30           email_1

....

...

...

2                    Y          1             44           refer_2

2                    Y          1             45           addr

.....

....

2                   Y          1             55            unit_1

2                   Y          1             56           email_1

....

2                    Y         1             70           refer_2

...

15 files are duplicates in the table above on our test database. Need to remove the lines - ' select * from calltab where call_no = 2 and call_var = 'Y' and the Group = 1 and call_ser between 55 and 70'.     We will need to create a script to remove duplicates in the customer database as call_ser might be different in the Production database. Is it possible to create a script to remove duplicates without knowing the values of call_ser?

Thank you very much

Hello

GROUP is a keyword from Oracle, this is not a column name good.  We'll call your GRP column instead.

Thus, when 2 or more rows have the same call_no, call_var, grp and cname, you onoly want to keep the one with the call_ser down and remove all others.  Is this fair?

If so:

DELETE calltab

WHERE (call_no, call_var, grp, cname, call_ser) NOT IN

(SELECT call_no, call_var, grp, cname, MIN (call_ser)

OF calltab

Call_no GROUP, call_var, grp, cname

);

I hope that answers your question.

If not, CREATE TABLE and INSERT statements for your sample data (as it exists before deleting anything) and also post the results desired from these data (in other words, what table should contain after the deletion).  Point where the above statement was to get erroneous results, and explain how get you good results in these places.

See the FAQ Froum: Re: 2. How can I ask a question on the forums?

Tags: Database

Similar Questions

  • I can't delete a duplicate named folders created in error by Thunderbird while moving messages with drag and drop

    I had created a folder with a long as name "Deborah Brown - HP laptop acting, very slow, etc." this file was created to contain messages that have been received in a top-level folder, and then moved to this to the appropriate ranking related emails many. I had done many times before without a problem. But this time, when I slipped and fell on a message in the folder a double was created, but accompanied by an annex of '2547417' at the end of the name. IIRC, the message was in the records at the time of the original and a copy. IIRC, I did not notice this at first and when I dragged/left down another message he created another folder in double, but this time with the suffix "211613d". At any given time more far in the process (I don't remember quite well how) both of these files got duplicated again but this time were with the same name with added suffixes as noted... something I wouldn't have imagined. Given that the messages I was moving were safely (?) stored in the original folder, I deleted the message content duplicated records duplicated without any problem and without any effect on the content of the original file.

    Then I tried to delete the duplicate folders... not allowed. Then I noticed that if I tried to remove the second instance of each duplicate name, which was a success... at least as much as to move it to the trash. If I then returned and tried to delete the first instance it is, once again, not the law. I then tried to rename the files by adding a prefix a single character. Once more, if I worked on the second instance of the name I could rename it but would be foiled again if the first instance. Then, * I think * (extra large grains of salt here) is that I renamed the second instance and removed from the trash that I could then work on the others and rename and empty the trash.

    But everything for nothing. If I closed Thunderbird and restarted the duplicate folder names reappearing. Then I tried the fix given for not being able to delete messages because of a corrupt trash folder. That did not help either. Even if I use a POP account and could remove the files from the two basket my account information, whenever I would restart Thunderbird trash will reappear by himself and the so-called deleted duplicate files right with her and in the hierarchy of their original folder.

    I'm mystified and have given up trying to remove these things. Fortunately, the removal of messages from other folders and empty the trash of these messages seem to work normally. I have not yet tried to delete another folder and hesitate to do.

    Thank you
    Chuck Norcutt
    Murrells Inlet, SC

    Thank you very much. Exactly, that solved the problem. There was almost no delay in starting. I'm still very curious as to how it happened, but it may never be known.

  • can I delete the duplicate of a file

    can I delete the duplicate of a file

    On Saturday, December 18, 2010 03:04:40 + 0000, raftmoll wrote:
     
    > can I remove duplicate files in a folder
     
     
     
    It is not possible to have the files duplicate in a folder.
     
    Perhaps mean you that you have duplicated files in * two * folders.
     
    What can or should delete them depends entirely on what files
    are and what they are in folders. If these are files of Windows, no doubt
    No, but please be specific on the file names and folder.
     

    Ken Blake (MS-MVP)

  • Delete a duplicate based on conditions

    Hello
    < div style = "border: 1pt solid windowtext;" Padding: 1pt 4pt ">"
    {size: 9pt} SQL & gt; Select * from
    version of v$. {size}


    {size: 9pt} BANNER
    ----------------------------------------------------------------{size}


    {size: 9pt} Oracle Database 10g Express
    Edition Release 10.2.0.1.0 - product {size}


    {size: 9pt} PL/SQL Release 10.2.0.1.0-
    Production {size}


    {size: 9pt} CORE 10.2.0.1.0 Production {size}


    {size: 9pt} AMT for 32-bit Windows:
    Version 10.2.0.1.0 - Production {size}


    {size: 9pt} NLSRTL Version 10.2.0.1.0 & ndash;
    Production {size}

    < / div >


    You need to remove the lines that is duplicated in the Oracle table.

    Source
    -----
    EMPID NAME CYI
    -----
    1001. A MACH1
    1001. A MACH2
    1002 B MAH1
    C 1002 MAH1
    1002. A MAH1
    1003 X MACH12
    1003 X MACH1

    Output:

    -----
    I want to just delete a duplicate based on CYI = "MAH1.

    EMPID NAME CYI
    -----
    1001. A MACH1
    1001. A MACH2
    1002 B MAH1
    1003 X MACH12
    1003 X MACH1

    I tried with this request, but she considers in fact all duplicaes table...

    DELETE FROM test00 WHERE rowid NOT IN (SELECT max (rowid) OF test00 WHERE POINT = point 'A' AND GROUP BY)

    Thanks in advance

    Ananda.

    Something like this->

    SCOTT>
    SCOTT>select * from v$version;
    
    BANNER
    ----------------------------------------------------------------
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
    PL/SQL Release 10.2.0.3.0 - Production
    CORE    10.2.0.3.0      Production
    TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
    NLSRTL Version 10.2.0.3.0 - Production
    
    Elapsed: 00:00:00.04
    SCOTT>
    SCOTT>
    SCOTT>create table ananda
      2  as
      3    (
      4       select 1001 EMPID, 'A' N_AME, 'MACH1' CITY from dual
      5       union all
      6       select 1001, 'A', 'MACH2' from dual
      7       union all
      8       select 1002, 'B', 'MAH1' from dual
      9       union all
     10       select 1002, 'C', 'MAH1' from dual
     11       union all
     12       select 1002, 'A', 'MAH1' from dual
     13       union all
     14       select 1003, 'X', 'MACH12' from dual
     15       union all
     16       select 1003, 'X', 'MACH1' from dual
     17    );
    
    Table created.
    
    Elapsed: 00:00:00.18
    SCOTT>
    SCOTT>
    SCOTT>select * from ananda;
    
         EMPID N CITY
    ---------- - ------
          1001 A MACH1
          1001 A MACH2
          1002 B MAH1
          1002 C MAH1
          1002 A MAH1
          1003 X MACH12
          1003 X MACH1
    
    7 rows selected.
    
    Elapsed: 00:00:00.09
    SCOTT>
    SCOTT>
    SCOTT>delete from ananda
      2  where city = 'MAH1'
      3  and   rowid NOT IN (
      4                        select rr
      5                        from (
      6                                select rowid rr,
      7                                      empid,
      8                                      n_ame,
      9                                      city,
     10                                      row_number() over(partition by city order by empid) rn
     11                                from ananda
     12                                where city = 'MAH1'
     13                            )
     14                        where rn =1
     15                  );
    
    2 rows deleted.
    
    Elapsed: 00:00:00.10
    SCOTT>
    SCOTT>select * from ananda;
    
         EMPID N CITY
    ---------- - ------
          1001 A MACH1
          1001 A MACH2
          1002 B MAH1
          1003 X MACH12
          1003 X MACH1
    
    Elapsed: 00:00:00.09
    SCOTT>
    

    Kind regards.

    LOULOU.

  • I deleted the duplicates of my itunes media folder...

    I removed my itunes media folder a bunch of duplicates, but the changes are not seen in itunes. How do the folder and itunes have the same content? Can I delete music (all) iTunes somehow and replace it with the content of the media file?

    See Re: duplicate songs in the iTunes library

  • Y at - it an easy way to delete the duplicate in Windows Media Player... or should I put at ease and do it manually?

    I use iTunes and another person decided I want QuickTime to be my default player... I uninstalled who and now I have duplicates of music/video/photo everywhere! It's an invasion!

    Hi K.J.Kirt,

    Follow these methods.

    Method 1: To resolve this problem, delete the Windows Media Player database. To do this, follow these steps:

    (a) output Windows Media Player.

    (b) click Start, click run, type %LOCALAPPDATA%\Microsoft\Media Player, and then click OK.

    (c), select all the files in the folder and then click on Delete on the file menu.

    Note: You don't have to remove the folders that are in this folder.

    (d) restart Windows Media Player.

    Note: Windows Media Player automatically rebuilds the database.

    Method 2: If this does not resolve the problem, disable the Windows Media Player database cache files. To do this, follow these steps:

    (a) output Windows Media Player.

    (b) click Start, click run, type %LOCALAPPDATA%\Microsoftand then click OK.

    (c) select the folder Media Player and then click on Delete on the file menu.

    (d) restart Windows Media Player.

    Note: Windows Media Player automatically rebuilds the database.

    Method 3: When you move digital media files on the computer, the file name and file path information remain unchanged in the library. Then when you select a file to play to its new location, a new entry is created in the library if you select the automatically add to the library when played. As a result, the library can quickly contain a large number of entries, duplicate or invalid.

    To prevent music files to be automatically added to the library:

    (a) in the Player Windows Media, on the Tools menu, click Options.

    (b) in the Player tab, clear the checkbox Add music files to library when played .

    Now, when you play music on your computer or Internet files, the file will not be added automatically to the library.

  • I have thousands of photos stored on my laptop. Most are duplicates. Is there a way to delete all duplicates easily? Or I have to delete them one by one manually?

    I'm so out of space that I can not even run a disk defragmentation. I have ereased/deleted everything I can. I worked on the removal of all duplicate for 3 weeks now. Please, no matter who, me say there's another way to do it.

    Hey Bill,.

    I don't know if it's the best way, but what you could do is in the folder you are in, sort files by date modified. Most of the time, the duplicates are created at the same time or close.  Sort this will put all the duplicates together which makes them much easier to manage and delete.

    I hope this helps.

  • Deletion of duplicates of digtal drive

    Is it possible to delete duplicates of photos from a digtal drive without doing it one by one

    Hello

    What are these duplicate files, you are trying to delete?

    And how these files accumulate on your hard drive?

    You can try the steps mentioned below.

    1. open search by pressing the logo Windows + F key.

    2. in the find what box, type the name of the file that you suspect could be duplicated.

    3. on the toolbar, click views, and then click details.

    4 scroll down the list, looking for files with the file names and file extensions. When you find one or more of the files that match, compare their dates in the Date Modified column. If the dates are the same, the files are probably duplicates. You can open files and compare their contents to be sure.

    5. click on the file you want to delete and press DELETE.

    Eliminate duplicate files
    http://Windows.Microsoft.com/en-us/Windows-Vista/eliminate-duplicate-files

    You can navigate to the link below for more options on delete duplicate hard disk files.

    http://social.answers.Microsoft.com/forums/en-us/vistaperformance/thread/50ad7971-221C-417D-8b8e-422b16e4ca8d

    Let us know if this helps

    Concerning
    Anthony.

  • I am looking for an app to download which will find and delete the duplicate on my computer... If anyone can help...

    No good on this side of the computer... Computer works more slowly not as sharp as it was, I found a lot of files and duplicate files on it. Not understand or trust myself to remove anything manually.

    You might like to try these. Read their comments/user opinions 1-links provided:

    http://www.SnapFiles.com/reviews/CloneSpy/CloneSpy.html

    CloneSpy can help you recover hard disk space by detecting and removing duplicate files. It can find files that have the same exact content, regardless of their name, the date, time and location. CloneSpy is also able to search for files that are not identical, but have the same file name, allowing you to find and remove old versions of a file. Once the scan is completed, you can decide what you want to do with the found duplicates, CloneSpy you shows the details for each file (and its duplicate proposed) and allows to keep, move or delete.

    http://www.SnapFiles.com/reviews/duplicate-cleaner/duplicatecleaner.html

    Duplicate Cleaner is an easy to use program that helps you find and remove the duplicate computer files. You can search several structures of files at a time and set of criteria to identify duplicates. You can choose to search exact matches using the comparison of CRC or use the file name, size and date as the criterion. The program offers extended support for music files, allowing you to use the tag information ID (artist, title, album) to identify duplicate titles. The results are grouped together in a list and a selection wizard allows you to select quickly the files based on age, the audio quality, location and other aspects.

    See you soon.

    Mick Murphy - Microsoft partner

  • How to delete the duplicate and photos using windows 7 x 64 bit?

    I have a new computer using windows 7 x 64 bit. I noticed a lot of photos and files duplicate on my hard drive. It seems that any device that you plug into the computer it automatically records in the library under documents, music, pictures, etc... When configuring my e-mail or import/export does duplicate the same info, instead of ask or inform it is a duplicate. Help someone. I can't go directly to MS supports without going through many unnecessary changes. I JUST WANT TO KNOW WHAT I CAN DO?

    Hello

    If you look at the odds on these files, you can just about bet that they are safe to use.

    http://download.CNET.com/1770-20_4-0.html?query=duplicate+file+Finder&platformSelect=Windows&tag=srch&SearchType=downloads&FilterName=platform%3DWindows&filter=platform%3DWindows

    Auslogics has 4 stars which is a good rating at Cnet.

    Glary Utility has 4 1/2

    Need3Space - writing is here - 4 stars (not freeware)

    Duplicate File Finder - 4 stars

    Pay attention to the files you want to delete.  You will find a list of formats of files here.

    http://en.Wikipedia.org/wiki/Windows_file_types

    http://en.wikipedia.org/wiki/List_of_file_formats _(alphabetical)

    The digital negatives (RAW files) are safe remove.  These are digital files, camera or scanner, left on the disk, usually after photo/printing has been removed from the folder my pictures...

    http://en.Wikipedia.org/wiki/Raw_image_format

    Check the links classified by Ronnie Vernon for a better understanding of the libraries and files.

  • How to delete songs duplicate on my music folder?

    I have a few folder location how managed to double my music in my music on the computer... How can I remove them without individually select and delete?

    Hello

    You have an in Windows Explorer or Windows Media Player duplicate songs?

    If the songs twice in Windows Explorer it can only be manual selection and deletion, if you duplicate songs in Windows Media Player. I suggest you follow the steps mentioned below:

    Method 1:

    If only a small number of duplicate entries exist, try the following:

    a. click on the Windows "Start" and select "programs". Click on "Windows Media Player" to launch the media player.

    b. click on the "library" tab You should see a list of media files uploaded to the Windows Media Player library. Browse and search for files duplicate in the library. Duplicate files share the same name and usually appear side by side.

    c. right click on files duplicate you want to delete and click 'delete '. Repeat the steps to delete all of the duplicate in your Windows Media Library.

    For any consultation remove you items from the Windows Media Player library:

    http://Windows.Microsoft.com/en-us/Windows7/remove-items-from-the-Windows-Media-Player-library

    Method 2:

    If you have a large number of entries in doubles in your library (or if your library is duplicated), it might be better to create a new library.

    To resolve this problem, delete the Windows Media Player database. To do this, follow these steps:

    a. exit Windows Media Player.

    b. click Start, click Run, type %LOCALAPPDATA%\Microsoft\Media Playerand then click OK.

    c. Select all files in the folder and then click on Delete on the file menu.

    a. Note: you don't have to remove the folders that are in this folder.

    d. restart Windows Media Player.

    Note: Windows Media Player automatically rebuilds the database.

  • deleting files duplicate, the shadows and ghost from hard disk

    I had to sweep and re-download my pc about 3 times. There are still remnants of programs that I deleted, and I don't know how to erase them completely. Is there a software that will clean files duplicate, the shadows and Ghost and which will get rid of remnants of deleted files. Any help will be appreciated. Thank you

    Hello

    · What is the location of the remaining files of the programs that you have removed?

    You can run the disk cleanup utility to remove all unnecessary files on your computer.

    Delete files using disk cleanup

    http://Windows.Microsoft.com/en-us/Windows-Vista/delete-files-using-disk-cleanup

    Hope this information is useful.

    Amrita M

    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • How do I delete the duplicate in the doc folder in Windows 7?

    When I did the transfer of files to my new laptop, I transferred a large number of files that were already in my documents folder, how do I remove these?  forever, it will take to do this one at a time.  I have Windows 7.

    Hi PeneShort3,

    Unfortunately, you may need to delete the files manually duplicate.

    You can also use your favorite search engine to find and use any third-party application to remove the duplicate files.

    Warning: Using third-party software, including hardware drivers can cause serious problems that may prevent your computer from starting properly. Microsoft cannot guarantee that problems resulting from the use of third-party software can be solved. Software using third party is at your own risk.

  • Is it possible to efficiantly deletion of duplicate images.

    I was transfer images to my surface rt and I accisently made duplicates. too manyto ctrl click then delete however.

    If your copies had (2) added because you copied them in the same folder as your first copy, you can search the folder for matches, and then delete the results.  Type the following in the search box

    file name: "*" (2) *

    You can also try to resize your Explorer window to display only the two columns of thumbnails, then laso, selection of a column of objects using the mouse with a selection box.

  • Organizer of items still shows the deleted as duplicates files

    I recently imported pictures from a phone. Didn't like how I had chosen to organize the photos in my pictures folder, so I deleted them assuming I could re - import, this time without creating subfolders. Unfortunately, when I tried re-importing shows (423 duplicates excluded). How can I change this to see that they are no longer duplicates? The folder my pictures is empty as well as the trash and it still shows as having "duplicates".

    Running windows 8.1

    fmeist3r

    What version of Premiere Elements and its elements Organizer you have running on Windows 8.1 (supposed 64bits)?

    Your question suggests that you may have posted in the wrong forum. Your son got posted in the Forum Adobe Premiere elements (video).

    I suspect you want the Forum of Adobe Photoshop (photo editing) items.

    Photoshop Elements

    Generalize for now, if you need to try to find duplicates to remove them, please explore

    Elements Organizer/Find Menu / by Visual research/duplicate Photos.

    Global thinking to avoid duplication in the organizer of items, please refer to the discussion in this thread Elements Organizer Mac

    on the subject and in particular the Adobe Brett N employee's comments.

    Elements: How can I avoid imports of the Photo to duplicate on Mac?

    There is probably more information about this in Adobe Photoshop elements Forum whose link appears above.

    RTA

Maybe you are looking for