Remove duplicates of the chain

Hello

I need help to remove duplicates from a string that contains years and ' - '. Example: 1988-1997-2000-2013-1998-1965-1997-1899

I know it can be done in regular expressions, but have no experience in this area.

Select REGEXP_REPLACE (...) of double;

Thank you

SQL >-example of production line

SQL > with t (select ' 1988-1997-2000-2013-1998-1965-1997-1899' double Str)

2  --

3 - actual query:

4  --

5 Select listagg (str, '-') within the Group (order by null)

6 from select (separate str

7 in (select regexp_substr (str, ' [^-] +', 1, rn) str)

8 t

9 cross join (select rownum rn

10 in (select max (length (regexp_replace (str, ' [^-] +'))) + 1 mx)

11                                    from   t

12                                  )

13 connect by level<=>

14                           )

15 where regexp_substr (str, ' [^-] +', 1, rn) is not null

16              )

17       );

LISTAGG(STR,'-') WITHINGROUP (ORDERBYNULL)

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

1899-1965-1988-1997-1998-2000-2013

1 selected line.

Tags: Database

Similar Questions

  • Remove duplicates from the oracle table using 2 columns

    Hello

    I need to remove the duplicates of an oracle table based on 2 columns in the table.i tried to remove duplicates using the join, but get the error like sql error ora-00933

    Thank you

    Hello

    Here's one way:

    DELETE FROM table_x

    WHERE ROWID NOT IN)

    SELECT MIN (ROWID)

    FROM table_x

    Col_1, col_2

    );

    I hope that answers your question.

    If this isn't the case, please post a small example data (CREATE TABLE and only relevant columns, INSERT statements), and the results you want from this data.

    In the case of a DML operation (for example, REMOVE) the sample data should show what look like the paintings before the DML, and results will be the content of the or the tables changed after the DML.

    Explain, using specific examples, how you get these results from these data.

    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

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

  • Cannot remove duplicate in the people application contacts

    I have three cases of a person in my application of people, but when I go to the bar of the App on two of them, there is no clear list button. None of these two bodies have all the data in their profiles and they cannot be changed. I don't know how these contacts two thugs got there, but I would like to get rid of them.

    Hello

    Thanks for posting in the community of Microsoft Windows.

    I understand that you are unable to remove the duplicate in the people application contacts.

    I imagine the inconvenience that you are experiencing. I will certainly help the question of fixing.

    To help you suggest several steps to solve the problem, I would appreciate if you could answer the following question:

    . You have several configured accounts that have the same contacts?
     
     
    If you have the Microsoft account, then try to remove duplicates by following the steps in the link below:
     
    I hope that the information above helps you.
  • How can I remove duplicate in the massive window music player songs

    In the music player files window, I have several duplicate songs.  It's frustrating because he keeps doing again and again.  Help.  What can we do?  What is an upcoming update?  I can't stand this more

    Hi Kathleen,.

    How can I prevent double or invalid entries to be added to my library when I play music files?

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

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

    1. in Windows Media Player, click the Tools menu, Options.

    2. on the Player tab, clear music to add to the library when played check box.

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

    If you have problems, try these methods and check if it helps.

    Method 1: Clear database of Windows Media Player cache files.

    a. exit Windows Media Player.
    b. press the Windows key + R, type %LOCALAPPDATA%\Microsoftand then click OK.

    c. Select the Media Player folder, and then delete.

    d. restart Windows Media Player.

    Method 2: Delete the Windows Media Player database and check.

    a. exit Windows Media Player.
    b. press the Windows key + R, type %LOCALAPPDATA%\Microsoft\Media Player, and then click OK.
    c. Select all files in the folder, and then click 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.

    Please post back with the results and we will be happy to help you further.

  • remove duplicate in the table items

    I use under the code to two areas of clips. On the left 10 clips consisting of 2 columns and 5 rows. On the right an exact replica. It starts with the clip 1 on the left, as it is duplicated on the right, then clip 2 on the left, as it is duplicated on the right etc. Until the left and right are the exact same 10 clips in the same order.

    Now, I've added an event listener. The way I'd like it works when I click on for example the clip 4 left, not only this clip should be removed, but also his counterpart cut 4 right. And even the opposite effect: by clicking on the clip on the right 4 should remove both the right claw 4 as the left clip 4.

    The way I work now is is that if clicking the clips on the left. Who removes this clip and the clip on the right. I use indexOf to mid-range. By removing the clip on this site indexOf, which would be a clip on the left and the right clip by adding 1 to that indexOf. Since in the table, the clip of law (duplicate) immediately follows the left (foreground).

    Of course this does not the other way, when I click on a good clip first. Because I then have to subtract 1 from the location of indexOf to get the left clip version. But I can't think of a way to determine if the item clicked on is on the box on the right or left. I commented on this second line removeChild since it does not work when you click on a clip to right.

    Can anyone thing of the kind?

    var clipcopies:Array = new Array();

    for (var: lines: uint = 0; lines < 5; lines ++)

    {

    for (var cols: uint = 0; < 2; passes passes ++)

    {

    for (var: Cops: uint = 0; < 2; cops cops ++)

    {

    var character: clips = new clips();

    persona.scaleX =. 5;

    persona.scaleY =. 5;

    persona.gotoAndStop(cols+1+rows*2);

    Persona.x = (COL * (persona.width + 20) + 10) +(cops*300);

    Persona.y = (lines * (persona.height + 20) + 10);

    persona.addEventListener (MouseEvent.CLICK, clickPersona);

    addChild (persona);

    clipcopies.push (Persona);

    }

    }

    }

    function clickPersona(e:MouseEvent):void

    {

    var thisclip:uint = clipcopies.indexOf (e.target);

    trace (thisclip);

    removeChild (clipcopies [thisclip]);

    removeChild (clipcopies [thisclip + 1]);

    }

    use:

    var clipcopies:Array = new Array();

    for (var: lines: uint = 0; rows)<5; rows++)="">

    for (var cols: uint = 0; cols)<2; cols++)="">

    for (var: Cops: uint = 0; cops)<2; cops++)="">

    var character: clips = new clips();

    persona.scaleX =. 5;

    persona.scaleY =. 5;

    persona.gotoAndStop(cols+1+rows*2);

    Persona.x = (COL * (persona.width + 20) + 10) +(cops*300);

    Persona.y = (lines * (persona.height + 20) + 10);

    Persona.Name = line + "," + COL + "," + cops;

    persona.addEventListener (MouseEvent.CLICK, clickPersona);

    addChild (persona);

    clipcopies.push (Persona);

    }

    }

    }

    function clickPersona(e:MouseEvent):void {}

    removeChild (MovieClip (e.currentTarget));

    removeChild (getChildByName (e.currentTarget.name.split (",") [0] + ',' + (1 - int (e.currentTarge t.name.split (",") [1])));)

    }

  • Remove duplicates from the result set

    Here's a challenge question that I was playing with a my free time during the work.

    I assume you have the basic HR example somewhere around (I hope is not in production).

    Let's say you want to get employees from the employees table whose name is similar to another employee last name.
    The easiest way is to join the two tables with a join condition that checks for the name and employee id. Here's what I came with.

    *************

    Select e1.last_name, e1.first_name b, e2.last_name c, e2.first_name d
    employees employees join e1 e2
    on (e1.last_name = e2.employee_id <>e2.last_name and e1.employee_id)
    order by one;

    ************

    The above query returns 10 rows. The first and the second are essentially the same. It is similarly, 3 & 4, 5 & 6, 7 and 8 and 9 and 10. The question is: is there a way that allows me to get rid of using only sql duplicate rows from the result set of this query. I sat on it for 15 minutes and I couldn't know. I'll try to watch my completed work once again.

    Example:

    SQL> column a format a10
    SQL> column b format a10
    SQL> column c format a10
    SQL> column d format a10
    SQL>
    SQL>
    SQL> select e1.last_name a , e1.first_name b, e2.last_name c, e2.first_name d
      2  from employees e1 join employees e2
      3  on ( e1.last_name = e2.last_name and e1.employee_id != e2.employee_id)
      4  where e1.employee_id < e2.employee_id
      5  order by a;
    
    A          B          C          D
    ---------- ---------- ---------- ----------
    Cambrault  Gerald     Cambrault  Nanette
    Grant      Kimberely  Grant      Douglas
    King       Steven     King       Janette
    Smith      Lindsey    Smith      William
    Taylor     Jonathon   Taylor     Winston
    
    SQL>
    
  • How to remove duplicates from the PL - SQL table?

    Hi gurus,

    I have a PL - SQL table with the following structure
    Authors (SR_NO, Auth_Code, Change_Date, cost)

    This table is filled using a slider. However, this table can have a few lines in double (for column (Auth_Code)
    for example
    SR_NO      Auth_Code       Change_Date                       Cost
    1               A1             14-FEB-09 08.18.47 AM          11.00
    2               A2             14-FEB-09 08.18.56 AM       2839.00
    3               A1             15-FEB-09 08.00.02 AM      1299.00
    4               A1             15-FEB-09 07.00.00 AM        789.00
    5               A3             14-FEB-09 08.18.56 AM        312.00
    6               A4             14-FEB-09 08.19.02 AM        233.00
    I need to get the above result set select the separate lines of Auth_Code including the Change_Date is maximum (and store in another PL - SQL table for treatment later or even the removal of this table will be also!)

    of the data A1 is duplicated and a maximum Change_Date above = 15 February 09 08.00.02 AM.
    Where my PL - SQL Table that results must have given below
    SR_NO      Auth_Code       Change_Date                       Cost
    2               A2             14-FEB-09 08.18.56 AM       2839.00
    3               A1             15-FEB-09 08.00.02 AM      1299.00
    5               A3             14-FEB-09 08.18.56 AM        312.00
    6               A4             14-FEB-09 08.19.02 AM        233.00
    I'm not very aware of the PL - SQL tables and there is no chance to change the existing cursor that fills the data in this table PL - SQL.
    I guess that I need to compare each record of PL - SQL table with others, but do not know how to do this.

    Could you please help?

    Hello

    Like this?:

    Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
    Connected as hr
    
    SQL>
    SQL> with data as(
      2  select 1 as SR_NO, 'A1' as Auth_Code, to_date('14-FEB-09 08.18.47', 'dd-mon-yy hh24:mi:ss') as change_date,    11.00 as cost from dual union all
      3  select 2 as SR_NO, 'A2' as Auth_Code, to_date('14-FEB-09 08.18.56', 'dd-mon-yy hh24:mi:ss') as change_date,  2839.00 as cost from dual union all
      4  select 3 as SR_NO, 'A1' as Auth_Code, to_date('15-FEB-09 08.00.02', 'dd-mon-yy hh24:mi:ss') as change_date,  1299.00 as cost from dual union all
      5  select 4 as SR_NO, 'A1' as Auth_Code, to_date('15-FEB-09 07.00.00', 'dd-mon-yy hh24:mi:ss') as change_date,   789.00 as cost from dual union all
      6  select 5 as SR_NO, 'A3' as Auth_Code, to_date('14-FEB-09 08.18.56', 'dd-mon-yy hh24:mi:ss') as change_date,   312.00 as cost from dual union all
      7  select 6 as SR_NO, 'A4' as Auth_Code, to_date('14-FEB-09 08.19.02', 'dd-mon-yy hh24:mi:ss') as change_date,   233.00 as cost from dual)
      8  select * from data d where change_date = (select max(change_date) from data d2 where d.auth_code = d2.auth_code);
    
         SR_NO AUTH_CODE CHANGE_DATE       COST
    ---------- --------- ----------- ----------
             2 A2        14/02/2009        2839
             3 A1        15/02/2009        1299
             5 A3        14/02/2009         312
             6 A4        14/02/2009         233
    
    SQL>
    

    Kind regards

  • Remove parts of the chain

    Hi all.

    I need some guidance with this. An object list in a form, users can choose several options. In particular, it is of is interested in the course students. The form has been sent as an email. The marketing department now wants to use a db e-mailing - so I need to work with the existing form and put the values in the DB, additional to the email. In other words, I'm not supposed to change anything on the existing forms. When they choose the course, the transmitted data looks like this;

    126211 graduate certificate in banking, 128511 certificate of graduate studies in contractor

    In the comic book, they only want the number of courses. How can I get rid of everything, but the course numbers (divided by commas). I think it involves something with the help of the comma as a delimiter... but can not quite understand.

    Thanks for your help.

    Adrian Wagner

    Since you know the entry of the form (which said you unmodifiable), the following examples should work. Example 1 uses a regular expression to replace characters. Example 2 converts the beginning of a string to a number.

    The regular expression in the example 1 replaces a - z and a blank space. You can add to the regular expression if the other characters need to be replaced.





    #y #.






    #i #.
















    #z #.

  • the option remove duplicates has been removed!

    I have just been advised by apple to use this option to remove duplicate songs - the option has been removed. Why?

    Hello

    You can always find the duplicates. It was move to file > library > show duplicate items.

    Jim

  • To check and remove duplicate records

    Hi guys,.

    I have a T1 table where my col_1, col_2, col_3 columns are primary keys and the table is to have a huge volume of data recorded about 200 billion. Before you add the primary key, I need to check if there are duplicates and then delete these records. Who will be fastest way to check, I used below

    Select * from T1

    where rowid in (select rn (INF. Select rowid,

    DENSE_RANK() on ln (score of col1, col2, col3 order by rowid)

    from T1)

    where ln <>1);

    Is there another way using the analytical function can be faster to access the records of 200 billion

    Sven wrote:

    Instead of making a deletion consider to re-create the table using only the unique values. Very often, it's much faster than a delete even if more data is moved, but as always, it depends.

    It would be useful if you know how many lines you have and how duplicates are for example (the number of records is removed).

    Also, you should have a comparable test database, which is not always easy to have with large datasizes are invloved.

    Yes, Sven is quite right, ETG might actually be faster to remove duplicates of the original. But you will need to investigate the volume of data.

    create table T2 as

    Select col1, col2, col3,..., coln - all original columns except rn

    from (select t.*, row_number() on rn (score of col1, col2, col3 order by rowid)

    t)

    where rn = 1

    /

    Then hover over any constraint, etc. and drop T with purge, rename T2 in T.

  • If time machine is incremental how it removes previous versions when the disk is full, without breaking the chain, so do not be able to restore all changes since the first full file

    If time machine is incremental how it removes previous versions when the disk is full, without breaking the chain, so do not be able to restore the file with any changes made since the full backup first file...

    If the TM drive storage is full TM automatically deletes the version the oldest files for the new incremental backups can be made. Thus, in this case you cannot restore the versions that TM deleted because it takes more storage.

  • 3.6.2 the numbers help find and remove duplicates in 2 columns

    Could someone help me please. I run a karaoke business. As you may have guessed I have books with many songs, 64 000 and more than 75% of these songs are duplicates so you can imagine by train to sort. Option 1 I could manually go through my list by removing duplicates or option 2 attempt to find a formula that works save me hours of blind deletion. Is there someone out there who can help? It would be much appreciated thanks.

    Here is a sample of the document I'm working.

    Hi robi.

    Here is a solution of Craig s. Ruddock in this discussion Re: duplicates warning formula

    Formula in B2 (fill down)

    = IF (COUNTIF($A,A) = 1",","duplicate")

    Now sort by column A

    Remove all but one of the "duplicate" lines for each song.

    Kind regards

    Ian.

  • Removing duplicates, I usually have to remove the song duplicate twice to make it disappear. Why?

    When you remove duplicate songs, I usually have to remove the song duplicate twice to make it disappear. Why?

    When I delete the duplicate song it pops up again. When I erase it a second time he remains missing.   After the first removal, he reappeared with a little cloud in an arrow down. Once I have remove that she remains missing.

    Is it possible that I can delete a song in one operation?

    iTunes 12.3.3 on Mac Pro Tower

    Looks like you have an iCloud music library, Subscribe to Match iTunes Apple music (or both).  The first time, you probably delete the local copy of the song file (stored on the storage of your computer).  But the song still in your iCloud library, so it appears in your list of music library with the cloud with the arrow symbol (which you can click to download it again).  You can still play the song streaming from iCloud.  The second time, you delete the song completely within your music to iCloud library.

    You can see the distinction if you right click on a song (which is stored locally) in iTunes.  On the shortcut menu that appears, there are two separate, Remove Download and deletecommands.  Remove Download removes the local copy of the song file, but keeps the song in your music to iCloud libraryDelete deletes the song completely, with a single action.

  • I have about 14 000 songs in my library, about 4 copies of each of them. Try to remove duplicates, but can only do one at a time. I spent many hours, check all the files I want to delete only to find out that I can't delete them both?

    I have about 14 000 songs in my iTunes library, but really there are only about a quarter as much because there are so many duplicates. I don't know how they got there in the first place, and try to remove them is infuriating! I have already spent several hours going by checking all the files I want to remove (thinking that I would delete then all files at once) - only to find out that I still have to delete them one at a time. There must be a better way! Help, please.

    If you don't know that you want to delete all checked the songs in your library:

    • Create a new smart playlist with the following rules:

      This will show then checked all the songs in your library.
    • Select all the items in this playlist (Ctrl-A)
    • Hold the SHIFT key and press DELETE - follow the prompts to remove songs from your library and (if necessary) your PC media files

    In case of problem, you must back up your library before you do just in case the results are not what you expect - see tips to the user of turingtest2 on your iTunes for Windows with SyncToy to backup library for a suitable and recommended method.

    There is no 'simple' way to reliably remove duplicates from a library, but see the intelligence in this threadon the use of a scripted for removal of duplicates (for example).

    Long-term, try and avoid adding anything in your iTunes library that already exists in it - that's how arise the duplicates (unlike an opinion apparently dispersed, iTunes not of is duplicate anything in normal operation).  I've seen several comments suggesting here a few users to correctly copy their library from an old computer to a new one and then add the content of its media files - guaranteed way to finish with a copy of database entries or media files.

  • How can I remove duplicates "ESSENTIALS" in the workspace?

    The problem is the audit program, I typed the word ESSENTIALS and saved. But you cannot remove, even after you choose for deletion.

    I tried to look (search bar) for the folder in the program installed in file. There was no file.

    Tried to reinstall the program and delete the program folder it came with, still no luck removing duplicates after installation again. Tried 3 times.

    Someone here knows another way?

    workspace.png

    Someone here knows another way?

    You're on Mac or Windows?

    If Mac then look in the library (hidden default) user / Application Support / Adobe / BridgeXX / workspaces. Inherent must be a list of created custom you can manually delete the workspaces.

Maybe you are looking for

  • 2 to 9.3.2 improved iPad keyboard problem

    software iPad 2 Update 9.3.2,and now the keyboard is divided into two parts - qt on one side and yp on the other side for all applications, gmail, display, pages, etc. How to return to the software 9.3.1?

  • Ethernet Cable length

    The distance between my Airport Extreme to my end 2012 21.5 "iMac is 20 meters . The Ethernet cable is CAT 5e , 1. upgrade to CAT 6 will make no improvement? 2. is it compatible with CAT 6 Airport Extreme? Thank you...

  • Resistance problem for the wireless network password

    I have a v300 tablet, when I try to connect to my wireless network and I put the password wireless I get an error that reads: "the network passwords must be 40 bits or 104 bits according to your network congifuration, it can be entered as 5 or 13 asc

  • System32 NvMc Tray.dll/system32 nvsvc.dll/systema32 C:\windows\system32\nvcpl.dll

    Cuando arranquo mi sistema, cada uno appears:... NvMc Tray.dll... nvsvc.dll,... C:\windows\system32\nvcpl.dll, indicating that none is can find el Modulo. Of course lo avatar.3D.DVDSCR.XviD. That I have that hacer para each y/o del systema eliminarlo

  • Can I install Win 7 Professional on a computer that is running Windows 10

    I am looking to buy Windows 7 Professional, our work computer is running win base 10, there will be a problem buying and loading win 7 pro on win 10 and microsoft will continue to support win 7 pro. We are not fans of the new victory 10 and need to f