eliminating duplicates except one

DB and dev rel2 10g,

Hi all

suppose I have a table with a lot of duplicate rows,

what I need is to remove duplicates and keep a row of these duplicates.

as

column - with these values...

Hello

Hello

Hello

How to remove two (of salvation) and retain the third?

All of it is applied to all the duplicate values in the column

Thanks in advance

Hello

Here's one way:

REMOVE table_x

WHERE ROWID NOT IN)

SELECT MIN (ROWID)

FROM table_x

GROUP BY col_1

)

;

When it ends, exactly 1 row of each col_1 value to.

I hope that answers your question.
If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) and also publish outcomes from these data.
If you ask a DML statement, such as DELETE, the sample data will be the content of the or the tables before the DML, and the results will be the State of the or a modified tables when it's all over.
Explain, using specific examples, how you get these results from these data.
See the FAQ forum: https://forums.oracle.com/message/9362002

Tags: Database

Similar Questions

  • All messages deleted, except one

    Woke up this morning to find that all SMS my phone had mysteriously been deleted, except one - and in this message, the entire thread has disappeared except for the most recent text (likely received after the removal of mass). Of course I don't have a recent backup, not even with iCloud, but the strange thing is that not even 3rd 3rd party apps such as phone rescue could find no trace of my texts.

    The only thing that I get out of the ordinary last night has been to plug my phone into my computer to charge. I deliberately didn't synchronize it with iTunes or Photos, because they make my computer run very slowly and I was watching a video at the same time.

    I had a conversation by chatting with someone from Apple support and they have been unable to find a solution to the problem - they advised me to configure iCloud to make sure things have increased support, but even then, they said there is no way for messages save on iCloud.

    This happened to anyone before?

    Hi Muggleborn,

    Thanks for posting in the communities of Support from Apple! I understand that you had a few messages disappear randomly on your iPhone. I can certainly understand your concern, because I would not lose anything in my posts or the other. I am pleased to provide you with advice here.

    The first thing I want to make sure that you have checked is the option to keep the text messages. You can check this setting by going to settings > Messages > keep Messages and make sure that it is set to never. The other 2 options 30 days and 1 year will delete messages after this time elapsed.

    If you haven't already done so, you will also need to restart your iPhone.

    Restart your iPhone, iPad or iPod touch

    How do I restart

    1. Press and hold the sleep/wake button until the Red slider appears.
    2. Drag the slider to turn off your device completely off.
    3. Once the device turns off, press and hold the sleep/wake button again until you see the Apple logo.

    Just be sure that you do not restart power mentioned in the article

    I also recommend that you backup your iPhone regularly to iTunes or to iCloud. A backup also save messages so if ever you lose information on your iPhone in the future, you can easily restore your backup. I've included some resources below that go on what is included in backups and how to get these backups going.

    On safeguards for iOS devices

    The backup of your iPhone, iPad and iPod touch

    Take care!

  • How to properly temporarily disable all channels except one in the multichannel PID control loop?

    Hi all

    Help me please to solve the problem. How to correctly temporarily disable/enable all channels except one in the multichannel PID control loop?

    Thanks in advance,

    Oleg

    Hi Oleg,

    the entry "Car?" of the AdvancedPID is a table – as well as MS and pv entries.

    So what's the problem say - / allowing for a control (aka of entry) instead of all loop?

  • How can I delete all the email our except one

    How to delet all the email our except one

    Try the tools | Accounts show the accounts and then you can delete what you want.  If this does not help, then check out the suggestions of Fazil.

    Steve

  • inner join is not eliminating duplicates!

    Name of the table is customers

    VALUE CITY SIDE NUMS CNAME
    1 2001 Hoffman 100 1001 London
    2 Rome 2002 200 1003 Giovanni
    3 2003 Liu San Jose 200 1002
    4 2004 grass Berlin 300 1002
    5 2006 Clemens 100 1001 London
    6 2008 Cisneros San Jose 300 1007
    7 2007 perish Rome 100 1004

    Query is
    To find all pairs of customers having the same side

    I tried:

    SELECT c.cname, cb.cname FROM customers c INNER JOIN customers cb WE cb.rating AND c.cname = c.rating! = cb.cname

    CNAME CNAME
    1 perish Hoffman
    2 Clemens Hoffman
    3 Liu Giovanni
    4 Giovanni Liu
    5 Cisneros grass
    6 perira Clemens
    7 Hoffman Clemens
    8 grass Cisneros
    Clemens 9 perish
    10 Hoffman perish


    Ideally, it should up to 5 rows, but it does not return these lines for an e.g. Hoffman perish since I'm Perira Hoffman already. Your answers will be appreciated.

    Thank you
    Vaibhav

    Hi, Vaibhav,

    914683 wrote:
    Name of the table is customers

    VALUE CITY SIDE NUMS CNAME
    1 2001 Hoffman 100 1001 London
    2 Rome 2002 200 1003 Giovanni
    3 2003 Liu San Jose 200 1002
    4 2004 grass Berlin 300 1002
    5 2006 Clemens 100 1001 London
    6 2008 Cisneros San Jose 300 1007
    7 2007 perish Rome 100 1004

    Query is
    To find all pairs of customers having the same side

    I tried:

    SELECT c.cname, cb.cname FROM customers c INNER JOIN customers cb WE cb.rating AND c.cname = c.rating! = cb.cname

    Perhaps what you want is

    SELECT      c.cname
    ,         cb.cname
    FROM          customers  c
    INNER JOIN  customers  cb  ON   c.rating  = cb.rating
                                       AND  c.cname       < cb.cname     -- not !=
    ;
    

    CNAME CNAME
    1 perish Hoffman
    2 Clemens Hoffman
    3 Liu Giovanni
    4 Giovanni Liu
    5 Cisneros grass
    6 perira Clemens
    7 Hoffman Clemens
    8 grass Cisneros
    Clemens 9 perish
    10 Hoffman perish

    The title you chose for this thread is "inner join is not eliminating duplicates!
    Inner joins (or other types of joints) are not supposed to remove duplicates. Use SELECT DISTINCT to remove duplicates, which is exactly the same lines.
    You don't have to duplicate. For example, these lines of your result set:

    `        CNAME     CNAME
    1     Perira     Hoffman
    10     Hoffman     Perira
    

    are not identical; Indeed, the two columns are different.

    Ideally, it should up to 5 rows, but it does not return these lines for an e.g. Hoffman perish since I'm Perira Hoffman already.

    Please report the exact output of the sample data you want. (As said by Hoek, post CREATE TABLE and INSERT statements for the sample data too.)

  • [basiljs] remove all pages except one

    In a script, I create pages, export to PDF, remove pages and then create a new etc.

    Right now I use this:

    [code]

    for (var j = b.pageCount (); j > 1; j-) {}

    b.removePage (j);

    }

    [/ code]

    But it's really slow. I think that indesign made many calculation after deleting a page (deadline: link textfields) so it would be more efficient to remove all pages at once.

    Now my question is how do?

    I tested and if I delete about 5500 empty pages with the script it takes about 8 minutes.

    If I select all in indesign, and then delete it takes about 10 seconds.

    Another way to speed up a litle is to erase all the content. It will take a long time but probably a bit faster.

    Thing is that I have

    b.Clear (b.doc ());

    but this removes the master page as well and I need to keep the master page.

    In short, how to remove all pages (except one since indesign needs a single page) at the same time?

    Hello

    I will remove a lot of pages in indesign with

    • Use documentPreferences.pagesPerDocument (faster)
    • use while loop or for
    • Close doc without saving changes, and then open again. (in some cases)

    Here's the test code, run with old Macbook Air + CS5 + OSX10.7

    var pp = function (args) {
      $.writeln(args);
    }
    
    var remove_all_pages_use_pref = function (doc) {
      pp("start deleting (use preferences)");
      $.hiresTimer;
      doc.documentPreferences.pagesPerDocument = 1;
      pp("end deleting");
      pp($.hiresTimer);
    }
    
    var remove_all_pages_use_loop = function (doc) {
      var i = doc.pages.length;
      pp("start deleting (while --)");
      $.hiresTimer;
    
      while (i--) {
        if (i==1) {break;}
        doc.pages[i].remove();
      }
      pp("end deleting");
      pp($.hiresTimer);
    }
    
    function main() {
      var doc = app.documents.add();
      $.hiresTimer;
      doc.documentPreferences.pagesPerDocument = 5500;
      pp('# create 5500 pages');
      pp($.hiresTimer);
      var indd = new File("~/Desktop/5500.indd");
      doc.save(indd);
    
      pp("------------");
      remove_all_pages_use_pref(doc);
      doc.close(SaveOptions.NO);
    
      pp("------------");
      pp("# try another way");
      var doc2 = app.open(indd);
      remove_all_pages_use_loop(doc2);
      doc2.close(SaveOptions.NO);
    }
    main();
    

    result

    # create 5500 pages
    30395026
    ------------
    start deleting (use preferences)
    end deleting
    28215999
    ------------
    # try another way
    start deleting (while --)
    end deleting
    268641063
    

    Thank you

    mg

  • clear all items except one

    Hello all,.

    Can someone tell me how can I create a process that erases all the elements of a page except one Singel. I don't want a list of all the items on the process. Thanks in advance.

    I use Apex V4



    Zeng

    What is

    DECLARE
      lc_item_name VARCHAR2 := ''; --Name of the Item
      lc_item_value VARCHAR2;
    BEGIN
      --Get the Value of Special Item from Session
      lc_item_value := v(lc_item_name);
      --Clear the Page Cache
      APEX_UTIL.CLEAR_PAGE_CACHE (p_page => );  --Use the page whose cache has to be cleared
    
      --Set the session state of the item once again
      APEX_UTIL.SET_SESSION_STATE (p_name     => lc_item_name
                                                       ,p_value      => lc_item_value
                                                       );
    
    END;
    

    Alternatively, if the same thing using a branch that clears the cache of the page and in the section of item value, specify the name of the item in the to and from fields.

  • clear the cache of full page except one

    I need to reset the whole page (clear your cache), except one. How are you? I try not to go out all the items in the list. Can you help me?

    Thank you.

    WAN

    Hello

    You can try this kind process

    DECLARE
      l_temp VARCHAR2(32000);
    BEGIN
      l_temp := :Px_YOUR_ITEM;
      APEX_UTIL.CLEAR_PAGE_CACHE ('YOUR_PAGE_NUMBER');
      :Px_YOUR_ITEM := l_temp;
    END;
    

    Replace Px_YOUR_ITEM and YOUR_PAGE_NUMBER according to your need

    BR, JAri

  • I want to delete cookies, except one, when I go out. Is this possible?

    I have a web site that if their cookie is deleted, I must answer several questions of security to get to where I want to be. When I'm out FireFox I want to delete all cookies EXCEPT this one. Is this feasible?

    Thank you.

    You can do this with CookieCuller extension - https://addons.mozilla.org/firefox/addon/cookieculler/

  • Best way to reset all controls on the front panel except one?

    Hello world

    I have an interesting problem, whereby I need to run successive tests using a test station which has several indicators on the front panel. At the end of each test, I need to reset all to default values, with the exception of a control (Test ID) who needs to keep his information - its value is used in an initialization status for test to ask for information from a database, so it can not be reset with the rest controls.

    I post all orders at a time using a reference ThisVI and VI Default Vals.Reinit All method, but this will obviously reset my control values (Test ID) as well. Any suggestions on how to keep properly or may store this information control while resetting all others. I can reset individually others but there is a little and more can be added as this system is developed.

    I don't really know what is the right way to proceed, and Labview has maybe one trick in his bag that I know to work around this problem.

    Thanks in advance for your suggestions,

    Alex

    Flank the node invoke with two nodes in the value property of the control to maintain the value. To the left we read as well as a right and the wires together. Connect three nodes with a thread of error to establish the order of execution.

    First reading place value on the wire, which is then written after the values have been reset to the default value.

  • duplicate photo files. How can I remove duplicates except individually?

    For some reason, hundreds of photos in several files, the files have been reproduced with one (1) added.  How can I remove the others one by one?  This would take days!

    It would surely be preferable if you can save 'all' your photos to
    external media (DVD, USB drive, memory card, USB drive)
    before proceeding to drastic changes.

    * Proceed at your own risk *.

    If 'all' duplicate file names were added with (1)...
    I wonder if you could do a search for (1) and remove the result
    files?

    Windows Vista - tips for finding files
    http://Windows.Microsoft.com/en-us/Windows-Vista/tips-for-finding-files

  • duplicate exception

    Hello world

    Suppose I have an emp table where I have the composite primary key. It is baised empid and empname.
    During insertion, if I'm in a line double and with the exception of dup_val_on_index I wrote the null value.
    so, what happens if someone wants to insert a duplicate value.

    Will it be safe or it will not answer.

    exception
    When dup_value_on_index then
    null;
    end;


    concerning
    Rajat

    N °

    Why not check yourself?

    satyaki>
    satyaki>select * from v$version;
    
    BANNER
    ----------------------------------------------------------------
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
    PL/SQL Release 10.2.0.1.0 - Production
    CORE    10.2.0.1.0      Production
    TNS for Linux: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    
    Elapsed: 00:00:00.00
    satyaki>
    satyaki>
    satyaki>create table dd_emp
      2     as
      3       select *
      4       from emp;
    
    Table created.
    
    Elapsed: 00:00:00.04
    satyaki>
    satyaki>
    satyaki>select * from dd_emp;
    
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO JOB1      DOB
    ---------- ---------- --------- ---------- --------- ---------- ---------- ---------- --------- ----
          7499 ALLEN      SALESMAN        7698 20-FEB-81        176        300         30 SALESMAN
          7521 WARD       SALESMAN        7698 22-FEB-81       1375        500         30 SALESMAN
          7654 MARTIN     SALESMAN        7698 28-SEP-81       1375       1400         30 SALESMAN
          7788 SCOTT      ANALYST         7566 19-APR-87       3630                    20 ANALYST
          7839 KING       PRESIDENT            17-NOV-81       5500                    10 PRESIDENT
          7844 TURNER     SALESMAN        7698 08-SEP-81       1650          0         30 SALESMAN
          7876 ADAMS      CLERK           7788 23-MAY-87        121                    20 CLERK
          7900 JAMES      CLERK           7698 03-DEC-81       1045                    30 CLERK
          7902 FORD       ANALYST         7566 03-DEC-81       3993                    20 ANALYST
          7934 MILLER     CLERK           7782 23-JAN-82       1430                    10 CLERK
          7566 Smith      Manager         7839 23-JAN-82       1400          0         10 Manager   23-JAN-89
    
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO JOB1      DOB
    ---------- ---------- --------- ---------- --------- ---------- ---------- ---------- --------- ----
          7698 Glen       Manager         7839 23-JAN-82       1400          0         10 Manager   23-JAN-89
             1 boock
    
    13 rows selected.
    
    Elapsed: 00:00:00.00
    satyaki>
    satyaki>
    satyaki>alter table dd_emp add constraints pk_emp_no primary key(empno);
    
    Table altered.
    
    Elapsed: 00:00:00.02
    satyaki>
    satyaki>
    satyaki>begin
      2       insert into emp values(7499,'ALLEN','SALESMAN',7499,sysdate,2500,0,30,null,null);
      3       commit;
      4  exception
      5      when dup_val_on_index then
      6       null;
      7  end;
      8  /
    
    PL/SQL procedure successfully completed.
    
    Elapsed: 00:00:00.00
    satyaki>
    satyaki>select * from dd_emp;
    
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO JOB1      DOB
    ---------- ---------- --------- ---------- --------- ---------- ---------- ---------- --------- ----
          7499 ALLEN      SALESMAN        7698 20-FEB-81        176        300         30 SALESMAN
          7521 WARD       SALESMAN        7698 22-FEB-81       1375        500         30 SALESMAN
          7654 MARTIN     SALESMAN        7698 28-SEP-81       1375       1400         30 SALESMAN
          7788 SCOTT      ANALYST         7566 19-APR-87       3630                    20 ANALYST
          7839 KING       PRESIDENT            17-NOV-81       5500                    10 PRESIDENT
          7844 TURNER     SALESMAN        7698 08-SEP-81       1650          0         30 SALESMAN
          7876 ADAMS      CLERK           7788 23-MAY-87        121                    20 CLERK
          7900 JAMES      CLERK           7698 03-DEC-81       1045                    30 CLERK
          7902 FORD       ANALYST         7566 03-DEC-81       3993                    20 ANALYST
          7934 MILLER     CLERK           7782 23-JAN-82       1430                    10 CLERK
          7566 Smith      Manager         7839 23-JAN-82       1400          0         10 Manager   23-JAN-89
    
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO JOB1      DOB
    ---------- ---------- --------- ---------- --------- ---------- ---------- ---------- --------- ----
          7698 Glen       Manager         7839 23-JAN-82       1400          0         10 Manager   23-JAN-89
             1 boock
    
    13 rows selected.
    
    Elapsed: 00:00:00.00
    

    Kind regards.

    LOULOU.

  • Photo of icloud eliminating duplicates

    After hours of photo editing to delete the duplicate 'on all my machines', I turned to icloud Photos and discovered that they were still there and several other copies of the same.   I see that I can remove a photo of the iCloud at once, but I do not see a way to select several images (now the SHIFT key) and then delete.

    After hours of editing Photos to delete the duplicate 'on all my machines. "

    You empty the album 'Recently deleted' to delete the photos terminally?

    I turned to icloud Photos and discovered that they were still there and several other copies of the same.

    Did you wait for the delition of synchronization?  It can take hours for the removal to synchronize with icloud.  Your Mac shows earlier "up to date" in the "Photos > Preferences > iCloud" or is he still saying "update"?

    And if you scroll to the bottom of the tab Moments www.icloud.com photos, does always show updated?

    The app is very slow display updates. Libraries of my Photos on my Mac synced with iCloud and demonstrate 453232 photos, but on iCloud the last 3000 photos that I took on a trip are still missing.

    Do not delete photos directly on iCloud, then photos to www.icloud.com is always up-to-date.

  • Computer connects to the Internet on all networks, except one

    A few days ago my computer stopped at random to connect to the internet via an Ethernet cable in my apartment.  It works very well, continuously for more than a year.  I first thought the network was down, but to verify ports three separate wall in our apartment (including the one in question) computer of my roommate and his computer connected perfectly.

    My computer can still connect to other networks (different buildings) both via radio and connected via Ethernet, if this isn't a hardware problem.  Currently, we have a wireless router configuration in our apartment that my computer can connect to.  For some reason when I am connected to the network via an Ethernet cable, the computer cannot access the internet.
    When connected, the State jumps back between "Internet access" and "no Internet access.  I tried to ping www.google.com and several other IPs known without success.  Works fine when I go wireless.
    I tried the following, without success:
    Reinstalled drivers for network cards
    Reset the network settings
    Reset Windows sockets
    Enabled IPv4 and IPv6
    Add favorite DNS servers (google and a few others)
    Restart
    System restore
    If anyone has any ideas, I can provide more information, if it helps...
    Thank you

    The problem was somewhat resolved.  When the connection to the Local network has been filled with the wireless network connection, the Internet took over.  I unplugged the router wireless and internet still works, so I'll consider it a success so far.

  • REGEXP_REPLACE return strange results and eliminating duplicate characters

    I try using REGEXP_REPLACE to remove all the characters that is not a letter or a number, but I get strange results. It seems to eliminate duplicate characters. The result varies also with the order of the boss. How can I solve this?

    SELECT REGEXP_REPLACE(p_str,'[^[:digit:]][^[:alpha:]]','.') FROM (SELECT 'AAA bb' double p_str);

    > AA.bb

    SELECT REGEXP_REPLACE(p_str,'[^[:alpha:]][^[:digit:]]','.') FROM (SELECT 'AAA bb' double p_str);

    > AAA.b

    Oracle Database 11 g Release 11.2.0.3.0 - 64 bit Production

    to remove all characters which is not a letter or a number

    You can try (it's more flexible for alphabets and numbers)

    [^ [: alnum:]]

    See you soon,.

    Manik.

Maybe you are looking for

  • Canvio Duo 2 TB not recognized by windows

    Hello I am Alexandra, My problem is that after updates, win 10 does not recognize the HDD... files appears in the Manager of can someone help me?

  • dialog two buttons

    Hello. currently im doing a project to detect road marking using multiple special geometric criteria. My idea was when the user has two choices, the program prompts the user to choose which way to go. in my program, I used a marking 'go left or right

  • Reinstall XP after issuance of the virus, now says the invalid product key

    Also, our computer has a Trojan virus.  We try to raise our professional XP OS and continue to get the message that we have an invalid product code, but we do not have.  He is absolutely right.  Any ideas?

  • The Internet is only going slowly on this computer, it used to be fine

    I currently have windows XP, and my internet has suddenly slowed down my internet is only going slowly on this computer, none of the other computers I have connected to the internet suffer all pass 100% only this computer and I ran virus scan using m

  • Failure of 'pipeline' printing/Windows Vista and HP 5740

    Windows vista and hp office jet 5740: all of a sudden, I get the message of failure to print: PRINT FILTER PIPELINE HOST STOPPED WORKING AND WAS CLOSED.  I do not understand what it is and I tried to find solutions that I CAN understand and have had