Removal of duplicate records: (please respond to it ::))

Hi experts I'm new to the oracle. Me please with this deletion request.

Whenever the mobileno TEST_REG , TEST_MUL matches then it should check for accountno gets duplicated in the TEST_MUL table.
If duplicate accounts exist for this particular mobileno
Then delete this duplicate accountno, whose IDS are not equal in both the
tables (accountno recordings should get deleted from the test_mul table)

             
Script For the query :
---------------------

create table test_mul (mobileno VARCHAR2 (20 Byte),accountno VARCHAR2 (20 Byte),id VARCHAR2 (12 Byte),v_date date);

create table test_reg (mobileno VARCHAR2 (20 Byte),id VARCHAR2 (12 Byte),r_date date,mas varchar2(1) default 'Y');



alter table test_mul modify v_date default sysdate;

alter table test_reg modify r_date default sysdate;


Insertion of records into test_reg table :


insert into test_reg (mobileno,id) values ('+227299001081','AAA');
insert into test_reg (mobileno,id) values ('+911000000001','BBB');
insert into test_reg (mobileno,id) values ('+911000000002','CCC');
insert into test_reg (mobileno,id) values ('+911000000005','DDD');
insert into test_reg (mobileno,id) values ('+911000000006','EEE');
insert into test_reg (mobileno,id) values ('+911000000007','FFF');

commit;



==================================================================


INSERT INTO TEST_MUL(mobileno,accountno,id) VALUES ('+227299001081','37775521122561','AAA');

INSERT INTO TEST_MUL(mobileno,accountno,id) VALUES ('+227299001081','37775521122561','123');

INSERT INTO TEST_MUL(mobileno,accountno,id) VALUES ('+227299001081','43443345432344','AAA');

INSERT INTO TEST_MUL(mobileno,accountno,id) VALUES ('+227299001081','43443345432344','AAA');
------------------------------

INSERT INTO TEST_MUL(mobileno,accountno,id) VALUES ('+911000000001','08490100005169','BBB');

INSERT INTO TEST_MUL(mobileno,accountno,id) VALUES ('+911000000001','08490100006867','BBB');

INSERT INTO TEST_MUL(mobileno,accountno,id) VALUES ('+911000000001','08490100009602','BBB');

INSERT INTO TEST_MUL(mobileno,accountno,id) VALUES ('+911000000001','08490100009602','456');

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


INSERT INTO TEST_MUL(mobileno,accountno,id) VALUES ('+911000000005','47775524511505','DDD');

INSERT INTO TEST_MUL(mobileno,accountno,id) VALUES ('+911000000002','47775521111505','DDD');

INSERT INTO TEST_MUL(mobileno,accountno,id) VALUES ('+911000000002','47775524511505','789');

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



INSERT INTO TEST_MUL(mobileno,accountno,id) VALUES ('+911000000006','47775545611506','EEE');

INSERT INTO TEST_MUL(mobileno,accountno,id) VALUES ('+911000000006','47775521111506','EEE');

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


INSERT INTO TEST_MUL(mobileno,accountno,id) VALUES ('+911000000007','47987521111507','FFF');

INSERT INTO TEST_MUL(mobileno,accountno,id) VALUES ('+911000000007','47775521111507','FFF');

INSERT INTO TEST_MUL(mobileno,accountno,id) VALUES ('+911000000007','47775521111507','987');

commit;
Published by: 980560 on January 26, 2013 19:56

Question is what you want to do when:

SQL> select  *
  2    from  test_reg
  3  /

MOBILENO             ID           R_DATE    M
-------------------- ------------ --------- -
+227299001081        AAA          27-JAN-13 Y
+227299001081        BBB          27-JAN-13 Y

SQL> select  *
  2    from  test_mul
  3  /

MOBILENO             ACCOUNTNO            ID           V_DATE
-------------------- -------------------- ------------ ---------
+227299001081        37775521122561       AAA          27-JAN-13
+227299001081        37775521122561       BBB          27-JAN-13
+227299001081        43443345432344       AAA          27-JAN-13
+227299001081        43443345432344       BBB          27-JAN-13

SQL>

Or when:

SQL> select  *
  2    from  test_reg
  3  /

MOBILENO             ID           R_DATE    M
-------------------- ------------ --------- -
+227299001081        AAA          27-JAN-13 Y

SQL> select  *
  2    from  test_mul
  3  /

MOBILENO             ACCOUNTNO            ID           V_DATE
-------------------- -------------------- ------------ ---------
+227299001081        37775521122561       AAA          27-JAN-13
+227299001081        37775521122561       BBB          27-JAN-13
+227299001081        43443345432344       AAA          27-JAN-13
+227299001081        43443345432344       BBB          27-JAN-13

SQL>

SY.

Tags: Database

Similar Questions

  • Delete several duplicate records

    Hi all
    My table has multiple records, and I want to keep only the first record in the table. Can someone help me on this. I tried following things:
    SELECT * FROM the tab
    WHERE ROWID in (SELECT MAX (ROWID) <>
    IN tab B
    WHERE B.col1 = A.col1
    AND B.col2 = A.col2
    )
    This remove the last duplicate record.
    I also tried
    SELECT * FROM the tab
    WHERE ROWID > (SELECT MIN (ROWID)
    IN tab B
    WHERE B.col1 = A.col1
    AND B.col2 = A.col2
    )
    This was removed and the first record to some places, but it has worked in some places. I am not able to understand why it was wrong in some places.
    I'm working on Oracle 10 g
    Please suggest.

    Thank you.

    Duplicate records mean reproduce according to specific columns (in your example, col1 and col2).
    If you want the trial to be held, you must determine all first according to what, if you mean the first entered record (which is not safe, and you should rely on an explicit column).
    You can use

    SELECT *
      FROM tab A
     WHERE ROWID NOT IN (SELECT MIN (ROWID)
                           FROM tab B
                          WHERE B.col1 = A.col1 AND B.col2 = A.col2)
    

    or use a column

    SELECT *
      FROM tab A
     WHERE col3 NOT IN (SELECT MIN (col3)
                           FROM tab B
                          WHERE B.col1 = A.col1 AND B.col2 = A.col2)
    

    Saad,

  • How to store the original and to remove some duplicate songs in iTunes on a PC Win7, which took place after iTunes to scan for music during a re - install?

    How to store the original and to remove some duplicate songs in iTunes on a PC Win7, which took place after iTunes to scan for music during a re - install?

    I recently had to format my hard drive and reinstall iTunes 12.3.2.35 on my Win7 PC. As part of the re - install iTunes, I clicked on the button scan for music.  This has created duplicates several of my songs.  I deleted then the duplicate songs from iTunes, but when I went to play a few songs a pop-up said "the song would not be because the original could not be found.  You want to locate? "When I tried to locate the song it is not found, but when I pulled the songs out of the trash they could be found.

    How can I keep the original and remove any duplicate songs in iTunes on PC Win7 which took place after iTunes to scan for music during a re - install?

    iTunes can create duplicates if the same content is added several times from outside the media folder when it is about to make copies of everything that is added to the library, or is added from an external drive that hosts the press kit that was disconnected during the launch of iTunes.

    Official notice of Apple on the duplicates is here: find and remove duplicates in your iTunes library. This is a manual process and article fails to explain some of the potential pitfalls such as the lost coast and membership of playlist, or sometimes the same file can be represented by multiple entries in the library as well as a removal and recycling the file will break all the others.

    Use MAJ > display > show items to reproduce exactly to display the duplicates because it is normally a selection more useful. You must manually select all but one of each group to remove. Sort the list by Date added can make easier select appropriate tracks, but it works better when executed immediately after the dupes were created.  If you have several entries in iTunes connected to a same file on the disk hard then don't not send to trash.

    Use my DeDuper script (Windows only) If you are not sure, do not want to do it by hand, or want to maintain ratings, play counts and playlist membership. See this background thread , this post for detailed instructions and Please take note of the warning to back up your library before deduping.

    (If you don't see the menu bar press ALT to temporarily view or CTRL + B to keep displayed.)

    The latest version of the script can put away the dead links as long as there is at least a double live to merge his stats and membership of the playlist and must deal wisely when the same file has been added through multiple paths.

    TT2

  • Remove boot run record vain NTSTATUS = 0 xC0000001

    Hello

    I have this message to the slieshow of my laptop but it started anyway! Remove boot run record vain NTSTATUS = 0 xC0000001's grave this? And that do pay message of what he's got rain? My EST 7 64 windows O.S

    Hello

     
     
    Please select your language from the drop-down menu above to post your question in the language of your choice. The forum in which you've posted is for English only. If you can't find your language above, support for additional international sites options are by following the link below:
     
     
     
     
    I hope this helps.
  • I have to remove the duplicate files, but having problems by selecting more than one file in the player at the time.

    I have to remove the duplicate files, but having problems by selecting more than one file in the player at the time. How can I select multiple files at the same time so I can just delete them. I used to be able to do this in previous versions of Media Player, but this function seems now blocked or unavailable. The problem is this: through previous use of media player, it plays all my multimedia files several times whenever a device support has been added. He would try to save the files on my main drive, but since there is not enough room this would save the files somewhere else. This happened several times, I suppose, because when I upgraded my computer and a media scan was conducted he found duplicates of all my media various times of at least 6-8. I've consolidated since my plates on 3-disc multi to, but have now records duplicated hundreds and thousands of duplicate media files. Previous versions of Media Player would allow me to select all files and then delete them both of the reader, but also from my hard drive. So now I'm stuck with more than 300 GB of duplicate media I have to search line by line through all my hard drives to find each duplicate both, unless I can get media player to do what it can. Any help in this area would be appreciated.

    Hello

    1. did you of recent changes on the computer?

    2. is Windows media player files in double creation during playback of music files?

    To delete duplicate entries, click on another feature tab in the drive (for example the current playback), and then click library.

    If this does not remove duplicates from your library, you can use the Add to library dialog box to search computer to analyze a file on your computer the duplicate entries not valid-pointing. The player will remove invalid entries in your library that point to files that no longer exist in the folder.

    Complete the steps above for files that are stored in the hard disks.

    Method 1: Use the add to Library dialog box search for computers

    (a) start Windows Media Player.

    (b) press F3 on your keyboard to open Add to the library of the find computers dialog box.

    (c) click the Browse button to locate the folder on your computer so that your library contains invalid entries. Specify the location of the folder in the box look in.

    If you are not sure what duplicate in your library entry is not valid, you can add a path column to display in your library. Specify the folder on your computer that corresponds to the path not valid file displayed in your library.

    (d) click on the Search button.

    The player will search for digital media files and playlists in the folder that you specify and remove invalid entries in your library that point to files that no longer exist in the folder. If not valid in double entries point to other folders on your computer, repeat this procedure, specify a different folder every time.

    If only a small number of duplicate entries exist, you can delete those invalid manually by right-clicking on the invalid entry, and then clicking Delete .

    For large double-number of entries in your library (or if all your library is duplicated), it might be better to create a new library and delete the files.

    Method 2:

    After you remove the duplicate entries, run the troubleshooting of Windows Media Library settings to solve this problem.

    Open the troubleshooter in Windows Media Library

    http://Windows.Microsoft.com/en-us/Windows7/open-the-Windows-Media-Player-library-Troubleshooter

    Let us know the results.

    I hope this helps.

  • Matching records between 2 tables with duplicate records

    Hi all

    I need help in what follows.

    I have 2 tables Received_bills and Send_bills.

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

    -The DOF for Table SEND_BILLS

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

    CREATE TABLE SEND_BILLS

    (DATE OF "DATUM",

    NUMBER OF "PAYMENT."

    'CODE' VARCHAR2 (5 BYTE)

    )  ;

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

    -The DOF for Table RECEIVED_BILLS

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

    CREATE TABLE 'RECEIVED_BILLS '.

    (DATE OF "DATUM",

    NUMBER OF "PAYMENT."

    'CODE' VARCHAR2 (5 BYTE),

    VARCHAR2 (5 BYTE) 'STATUS' )  ;

    INSERTION of REM in RECEIVED_BILLS

    TOGETHER TO DEFINE

    Insert. RECEIVED_BILLS (DATUM, PAYMENT, CODE, STATE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1', 'SUCCESS');

    Insert into RECEIVED_BILLS (PAYMENT, CODE, DATE, STATUS) values (to_date('10-OCT-15','DD-MON-RR'), 'A5', 'SUCCESS', 25);

    Insert into RECEIVED_BILLS (PAYMENT, CODE, DATE, STATUS) values (to_date('10-OCT-15','DD-MON-RR'), 47, 'A4', 'FAILED');

    Insert into RECEIVED_BILLS (PAYMENT, CODE, DATE, STATUS) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1', 'FAILED');

    Insert into RECEIVED_BILLS (PAYMENT, CODE, DATE, STATUS) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1', 'SUCCESS');

    INSERTION of REM in SEND_BILLS

    TOGETHER TO DEFINE

    Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1');

    Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1');

    Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1');

    Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 25, 'A5');

    Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 47, 'A4');

    Insert into SEND_BILLS (DATUM, CODE) values (to_date('09-OCT-15','DD-MON-RR'), 19, 'A8');

    Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 20, 'A1');

    Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1');

    Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 25, 'A5');

    Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 25, 'A5');

    I match all records of send_bills and received_bills with a status of 'SUCCESS' There is no single column in the table.

    Correspondence held payment of columns, the code and the scratch cards, but it may also duplicate records. But even if there are duplicates, I also need those records in the query results

    the query I wrote is this:

    SELECT SEND.*

    REC received_bills, send_bills send

    WHERE send.datum = rec.datum

    AND send.payment = rec.payment

    AND send.code = rec.code

    AND 'rec.status =' SUCCESS

    ;

    The query results give me this

    OCTOBER 10, 1519A1
    OCTOBER 10, 1519A1
    OCTOBER 10, 1519A1
    OCTOBER 10, 1519A1
    OCTOBER 10, 1519A1
    OCTOBER 10, 1519A1
    OCTOBER 10, 1525A5
    OCTOBER 10, 1519A1
    OCTOBER 10, 1519A1
    OCTOBER 10, 1525A5

    The result of the correct application would be

    OCTOBER 10, 1519A1
    OCTOBER 10, 1525A5
    OCTOBER 10, 1519A1

    The select statement that I need I want to use a loop to insert records in another table.

    Can someone help me please?

    Thanks in advance.

    Best regards

    Caroline

    Hi, Caroline.

    Caroline wrote:

    Hi all

    I need help in what follows.

    I have 2 tables Received_bills and Send_bills.

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

    -The DOF for Table SEND_BILLS

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

    CREATE TABLE SEND_BILLS

    (DATE OF "DATUM",

    NUMBER OF "PAYMENT."

    'CODE' VARCHAR2 (5 BYTE)

    )  ;

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

    -The DOF for Table RECEIVED_BILLS

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

    CREATE TABLE 'RECEIVED_BILLS '.

    (DATE OF "DATUM",

    NUMBER OF "PAYMENT."

    'CODE' VARCHAR2 (5 BYTE),

    VARCHAR2 (5 BYTE) 'STATUS');

    INSERTION of REM in RECEIVED_BILLS

    TOGETHER TO DEFINE

    Insert. RECEIVED_BILLS (DATUM, PAYMENT, CODE, STATE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1', 'SUCCESS');

    Insert into RECEIVED_BILLS (PAYMENT, CODE, DATE, STATUS) values (to_date('10-OCT-15','DD-MON-RR'), 'A5', 'SUCCESS', 25);

    Insert into RECEIVED_BILLS (PAYMENT, CODE, DATE, STATUS) values (to_date('10-OCT-15','DD-MON-RR'), 47, 'A4', 'FAILED');

    Insert into RECEIVED_BILLS (PAYMENT, CODE, DATE, STATUS) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1', 'FAILED');

    Insert into RECEIVED_BILLS (PAYMENT, CODE, DATE, STATUS) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1', 'SUCCESS');

    INSERTION of REM in SEND_BILLS

    TOGETHER TO DEFINE

    Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1');

    Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1');

    Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1');

    Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 25, 'A5');

    Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 47, 'A4');

    Insert into SEND_BILLS (DATUM, CODE) values (to_date('09-OCT-15','DD-MON-RR'), 19, 'A8');

    Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 20, 'A1');

    Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1');

    Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 25, 'A5');

    Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 25, 'A5');

    I match all records of send_bills and received_bills with a status of 'SUCCESS' There is no single column in the table.

    Correspondence held payment of columns, the code and the scratch cards, but it may also duplicate records. But even if there are duplicates, I also need those records in the query results

    the query I wrote is this:

    SELECT SEND.*

    REC received_bills, send_bills send

    WHERE send.datum = rec.datum

    AND send.payment = rec.payment

    AND send.code = rec.code

    AND 'rec.status =' SUCCESS

    ;

    The query results give me this

    OCTOBER 10, 15 19 A1
    OCTOBER 10, 15 19 A1
    OCTOBER 10, 15 19 A1
    OCTOBER 10, 15 19 A1
    OCTOBER 10, 15 19 A1
    OCTOBER 10, 15 19 A1
    OCTOBER 10, 15 25 A5
    OCTOBER 10, 15 19 A1
    OCTOBER 10, 15 19 A1
    OCTOBER 10, 15 25 A5

    The result of the correct application would be

    OCTOBER 10, 15 19 A1
    OCTOBER 10, 15 25 A5
    OCTOBER 10, 15 19 A1

    The select statement that I need I want to use a loop to insert records in another table.

    Can someone help me please?

    Thanks in advance.

    Best regards

    Caroline

    Want to get answers that work?  Then make sure that the CREATE TABLE and INSERT statements you post too much work.  Test (and, if necessary, correct) your statements before committing.  You have a stray "." in the first INSERT statement for received_bills and receikved_bills.status is defined as VARCHAR2 (5), but all values are 6 characters long.

    There are 5 lines in send_bills that are similar to the

    10 OCTOBER 2015 19 A1

    Why do you want that 2 rows like this in the output, not 1 or 3, or 4 or 5?  Is it because there are 2 matching rows in received_bills?  If so, you can do something like this:

    WITH rec AS

    (

    SELECT the reference, payment, code

    , ROW_NUMBER () OVER (PARTITION BY datum, payment, code)

    ORDER BY NULL

    ) AS r_num

    OF received_bills

    Situation WHERE = 'SUCCESS'

    )

    send AS

    (

    SELECT the reference, payment, code

    , ROW_NUMBER () OVER (PARTITION BY datum, payment, code)

    ORDER BY NULL

    ) AS r_num

    OF send_bills

    )

    SELECT send.datum, send.payment, send.code

    REC, send

    WHERE send.datum = rec.datum

    AND send.payment = rec.payment

    AND send.code = rec.code

    AND send.r_num = rec.r_num

    ;

    Note that the main request is very similar to the query you posted, but the last condition has changed.

    If you need to insert these lines in another table, you can use this query in an INSERT statement. There is no need of a loop, or for any PL/SQL.

  • Check duplicate record all by preventing insertion

    Hello

    I have a scenario where I need to insert records from 20 000 to 30 000 daily in a table that has data in millions.

    Keep inserting a record in duplicate and in the event of any duplicate record, this issue need to be logged in another table.

    I used FORALL except SAVE to allow loading of all records not not duplicate. But with this approach, I am unable to know which record was duplicate or problems in the insertion.

    Also I can't use triggers to connect each record before insertion because I only need the duplicate records. Also, trigger will slow down performance.

    Guide kindly on what approach I should follow to do this (which are also good performance as data are huge).

    Kind regards

    Karki

    Logging error clause does not support dyrect path operations, you must remove the Add indicator to use.

    This is because the logging of errors using autonomous transaction.

    create table test_tomkt_raw
    (c1 varchar2(20),
    c2  varchar2(20),
    c3  varchar2(20));
    
    Table created
    
    Executed in 0,015 seconds
    create table test_mkt
    (c1 varchar2(20),
    c2  varchar2(20),
    c3  varchar2(20));
    
    Table created
    
    Executed in 0,031 seconds
    create table test_mkt_log
    (c1 varchar2(20),
    c2  varchar2(20),
    c3  varchar2(20));
    
    Table created
    
    Executed in 0,078 seconds
    insert into test_tomkt_raw VALUES( 'A','B','C');
    
    1 row inserted
    
    Executed in 0,015 seconds
    insert into test_tomkt_raw VALUES( 'A','B','C');
    
    1 row inserted
    
    Executed in 0 seconds
    insert into test_tomkt_raw VALUES( 'D','E','F');
    
    1 row inserted
    
    Executed in 0 seconds
    insert into test_tomkt_raw VALUES( 'R','BD','AC');
    
    1 row inserted
    
    Executed in 0 seconds
    insert into test_tomkt_raw VALUES( 'AQ','SB','AC');
    
    1 row inserted
    
    Executed in 0,016 seconds
    insert into test_tomkt_raw VALUES( 'AA','BA','CA');
    
    1 row inserted
    
    Executed in 0 seconds
    insert into test_tomkt_raw VALUES( 'A','B','C');
    
    1 row inserted
    
    Executed in 0 seconds
    insert into test_tomkt_raw VALUES( 'D','E','F');
    
    1 row inserted
    
    Executed in 0,016 seconds
    ALTER TABLE test_mkt
    ADD PRIMARY KEY (C1,C2,C3);
    
    Table altered
    
    Executed in 0,015 seconds
    BEGIN
      DBMS_ERRLOG.CREATE_ERROR_LOG('test_mkt');
    END;
    /
    
    PL/SQL procedure successfully completed
    
    Executed in 0,031 seconds
    INSERT /* APPEND */
    INTO TEST_MKT
    SELECT * FROM  TEST_TOMKT_RAW
    LOG ERRORS INTO ERR$_TEST_MKT ('TEST_01') --> This can be a variable on your code to identify this operation
    REJECT LIMIT UNLIMITED
    ;
    
    5 rows inserted
    
    Executed in 0,063 seconds
    INSERT INTO test_mkt_log
    SELECT er.c1, er.c2, er.c3
    FROM  ERR$_TEST_MKT er
    WHERE  er.ora_err_tag$ = 'TEST_01'--> This can be a variable on your code
    AND    er.ora_err_number$ = 1 --> Unique constraint violated
    ;
    
    3 rows inserted
    
    Executed in 0 seconds
    SELECT *
    FROM  TEST_MKT
    ;
    
    C1                  C2                  C3
    -------------------- -------------------- --------------------
    A                    B                    C
    AA                  BA                  CA
    AQ                  SB                  AC
    D                    E                    F
    R                    BD                  AC
    
    Executed in 0,062 seconds
    SELECT *
    FROM  TEST_MKT_LOG
    ;
    
    C1                  C2                  C3
    -------------------- -------------------- --------------------
    A                    B                    C
    A                    B                    C
    D                    E                    F
    
    Executed in 0,047 seconds
    DROP TABLE  test_tomkt_raw;
    
    Table dropped
    
    Executed in 0,032 seconds
    DROP TABLE  test_mkt;
    
    Table dropped
    
    Executed in 0,094 seconds
    DROP TABLE  err$_test_mkt;
    
    Table dropped
    
    Executed in 0,078 seconds
    DROP TABLE  test_mkt_log;
    
    Table dropped
    
    Executed in 0,047 seconds
    
  • How to remove all duplicate in my PHOTO collection

    Having a little problem, after I gathered all my photos in my hard drives many duplicates of photos in my albums, that I need to clean it. Under SEARCH in the help at the top bar on the left there is a Visual search to find duplicate photos, but how do you remove them? Can someone help me please in this case? Thank you

    Hi Mr.Ed.,.

    Could you please confirm whether the name of the image are the same or if the images looks like same.

    Please visit the following link: find and remove the duplicate Images in Lightroom | Lightroom training Laura shoe, tutorials and tips

    Kind regards

    Tanuj

  • ROW_NUMBER and duplicate records

    Hello

    Tried to delete duplicate records. The code below works, but would remove all, rather than simply the > #1 records:

    (SELECT academic_period, load_week, sub_academic_period, person_uid, course_number,
    course_reference_number, rowid that RID, row_number() over (partition of)
    academic_period, load_week, sub_academic_period, person_uid, course_number,
    order of course_reference_number of academic_period, load_week, sub_academic_period,
    person_uid, course_number, course_reference_number)
    Of THE cea
    WHERE (academic_period, load_week, sub_academic_period, person_uid, course_number,)
    IN course_reference_number)
    (SELECT academic_period, load_week, sub_academic_period, person_uid, course_number,
    course_reference_number
    Of THE cea
    GROUP of academic_period, load_week, sub_academic_period, person_uid, course_number,
    course_reference_number
    HAVING COUNT (*) > 1))


    If I try to put 'rn' and rn > 1, I get ora-00933: Sql not correctly completed command

    SELECT academic_period, load_week, sub_academic_period, person_uid, course_number,
    course_reference_number, rowid that RID, row_number() over (partition of)
    academic_period, load_week, sub_academic_period, person_uid, course_number,
    order of course_reference_number of academic_period, load_week, sub_academic_period,
    person_uid, course_number, course_reference_number): the nurse
    Of THE cea
    WHERE (academic_period, load_week, sub_academic_period, person_uid, course_number,)
    IN course_reference_number)
    (SELECT academic_period, load_week, sub_academic_period, person_uid, course_number,
    course_reference_number
    Of THE cea
    GROUP of academic_period, load_week, sub_academic_period, person_uid, course_number,
    course_reference_number
    After HAVING COUNT (*) > 1)
    and rn > 1

    I tried to remove as"rn" and make "rn" and "rn", which gave me an error of syntax also. The '' rn > 1 and '' clause gets an error of syntax also. I gone through a bunch of different Web sites. All of this indicates the syntax I am using will work. However, any query I run into a TOAD, always error when I include the 'rn > 1.

    Any ideas? Thank you!

    Victoria

    You mix two ways to identify duplicates.

    One way is HAVING:

    SELECT academic_period, load_week, sub_academic_period, person_uid, course_number, course_reference_number
    FROM cea
    GROUP BY academic_period, load_week, sub_academic_period, person_uid, course_number, course_reference_number
    HAVING COUNT(*) > 1)
    

    That tells you just what combinations of your group are more than once.

    Another way is to analytical functions:

    select *
    from (
      SELECT academic_period, load_week, sub_academic_period, person_uid, course_number, course_reference_number
             count(*) over (partition by academic_period, load_week, sub_academic_period, person_uid, course_number, course_reference_number) cnt
      FROM cea
    )
    where cnt > 1
    

    This will all return duplicate records - if some combinations has three duplicates, then this will return all three lines.

    If you use the ROW_NUMBER() place COUNT() analytical analytical function, you get this:

    select *
    from (
      SELECT academic_period, load_week, sub_academic_period, person_uid, course_number, course_reference_number
             row_number() over (partition by academic_period, load_week, sub_academic_period, person_uid, course_number, course_reference_number) rn
      FROM cea
    )
    where rn > 1
    

    All of these files without duplicates will get rn = 1. Those with duplicates gets rn = 1, rn = 2... If rn > 1 Gets all "unnecessary" records - the ones you want to remove.

    If a deletion might look like:

    delete cea
    where rowid in (
      select rid
      from (
        SELECT ROWID as rid,
               row_number() over (partition by academic_period, load_week, sub_academic_period, person_uid, course_number, course_reference_number) rn
        FROM cea
      )
      where rn > 1
    )
    

    Or if you want to manually inspect before you delete ;-):

    select *
    from cea
    where rowid in (
      select rid
      from (
        SELECT ROWID as rid,
               row_number() over (partition by academic_period, load_week, sub_academic_period, person_uid, course_number, course_reference_number) rn
        FROM cea
      )
      where rn > 1
    )
    

    In another answer, you can find a way to remove duplicates with HAVING.
    The point is that do you it either with or with ROW_NUMBER() - not both HAVING ;-)

  • How to delete duplicate records

    Suppose I have a table with N columns and K TAB (K < N) for which I should not have duplicated (in other words, the K column can be a key primary candidated)
    Can you give me a SQL query to delete duplicate records of TAB for columns K?
    Thank you very much!

    remove the tab where rowid not in (select min (rowid) of the TAB group by k)

  • remove the duplicate

    Hi all

    I have a table like

    tbl1
    ----
    Identification number
    name varchar2
    I have some duplicate records

    for ex:

    ID
    --
    1
    1
    2
    2
    2


    I need the sample script to delete some records until my unique id
    as

    ID
    --
    1
    2


    Help, please

    RowID is useful :D

    delete from table
    where RowID not in(select min(RowID) from table
                       group by id);
    
  • "Compression" duplicate records over time

    Hi, I've been fighting with a problem for a while now and don't know how to solve. I have data that looks like this:


    Code1... Code2... Start_Dt... End_Dt
    A.......... A......... 1/1/2000...12/31/2000
    A.......... A......... 1/1/2001...12/31/2001
    A.......... B......... 1/1/2002...12/31/2002
    A.......... B......... 1/1/2003...12/31/2003
    A.......... A......... 1/1/2004...12/31/2004
    A.......... A......... 1/1/2005...12/31/2005
    A.......... A......... 1/1/2006...12/31/2006

    What I would do in the data store is 'compress' duplicate records, so that the final result should look like this:

    Code1... Code2... Start_Dt... End_Dt
    A.......... A......... 1/1/2000...12/31/2001
    A.......... A......... 1/1/2002...12/31/2003
    A.......... B......... 1/1/2004...12/31/2006

    I can't figure a way to do it. I can just say:

    Select code1, code2, min (start_dt), max (end_dt)

    because I get A codes / has, from 01/01/2000 through 12/31/2006 - is not just, they have changed between the two.

    Does anyone know of a way to do this (base mode GAME please... not to write PL/SQL and do a rank at a time).

    Thanks in advance,
    Scott

    Hi Scott,.
    Try this SQL

    select a_code,b_code,group_id,min(start_date,max(end_date) from
    (select q.*,sum(change_flag) over (partition by a_code,b_code) group_id
            from
            (SELECT a_code,
                    b_code,
                    start_date,
                    end_date,
                    CASE
                    WHEN a_code = lag(a_code,1) over (partition by a_code,b_code ORDER BY start_date)
                       AND b_code = lag(b_code,1) over (partition by a_code,b_code ORDER BY start_date)
                    THEN 0 ELSE 1 END change_flag
                    FROM stp_test) q
    ) q2 group a_code,b_code,group_id
    

    Kind regards
    Oleg

    Edited by: oleg2 09/22/2009 06:30 - Add Group by at the end

  • remove the last record from the plsql table

    TYPE r_LOOPElement IS RECORD (TermID   NUMBER 
                                          );
    
    TYPE t_LOOPType IS TABLE OF r_LOOPElement INDEX BY BINARY_INTEGER;
    i_CustomerLoop      t_LOOPType ;
    
    i_CustomerLoop(1).TermID=1;
    i_CustomerLoop(2).TermID=2;
    i_CustomerLoop(3).TermID=3;
    Under certain conditions, I need to remove the last record from i_CustomerLoop

    whichi s the best way to do it. because I sometimes get duplicates for TermID in this plsql table.

    Hello

    See [removing items from Collection (DELETE method) | http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28370/collections.htm#CJAFGFIG]

    Kind regards

  • I have an ebookbrowse toolbar icon right next to my home screen icon. I can't understand how do to remove/uninstall it. Please notify.

    I accidentally visited the site to browse e-books, and apparently the site installed her own boyfriend of toolbar in firefox. I can't understand how to remove it. Help, please

    See also:

  • I do understand the benefit of "Options" tab utilities and want to remove it. How, please?

    I do understand the benefit of "Options" tab utilities and want to remove it. How, please? I tried this feature because the tab 'Fox' was no longer available with the 5.0 update.

    I loved tab 'Fox '. A click and go on a site added you to 'top sites' before. The update 5.0, this feature is no longer available. It was a disappointment. There is a similar feature "add on" that is, as tab 'Fox' compatible with 5.0. If yes I would like to know about it. Or better yet... make it usable with Firefox 5.0 ' Fox' tab if upgrades cancel features previously downloaded that work really... What's the point?

    Please click the button solved it next to the answer that solved your problem of Firefox support, it appears when you are connected, so this thread is marked as resolved to help other users who may have this same problem.

Maybe you are looking for

  • can not recharge the iPhone through MacBook in mode 'sleep'

    I used to be able to plug my iPhone 6 on my MacBook Pro from one day to the next and it would be both sync and charge with the MacBook into sleep mode. I recently bought a new MacBook Air, and as a first step, the phone has continued to charge when p

  • Satellite A210-12 q: where to find XP drivers

    Hello! I have this computer for a while now and I want to install XP.But I don't have drivers for xp and just a vista recovery cd, if should I go and how do I know which drivers I need? I looked around toshibas on page but I don't know what to downlo

  • Can I remove exe from the download folder once I installed the program?

    When I download a program the exe will in my download folder. After I installed the program, delete the exe file in my download folder? My file has become very large and messy. Thank you Moved from feedback Original title: download file

  • Dinner dash and yahoo messenger PlayFirst games does not

    My games of Playfirst, Diner Dash do not work. I tried to re - install my Diner Dash Through The Time and Hometown Hero but still, it has stopped working. They stop just after that I clicked on the button "play". Message reads like this: Signature of

  • How to save game on exit

    My hard drive has been replaced only and now Solataire is more requested save the game to exit even if I ticked the option. When I checked the box save I ws not had the opportunity to apply the change. How to encourage the solataire asking me if I wa