Remove Duplicate Rows in Numbers 09

Is there a way to remove duplicate rows in Numbers 09? For example I have 2 Tables and the values of Column A are mainly the same, but there are definitely a few dozen unique values in 1 table which are not in table 2 and visa versa. I'd like to make a new table with a column A with all of the values, but with duplicates removed so that I can then compare the values of a different column based on the value of Column A for each table.

I copied tabeau 1 and tableau 2 in tableau 3 then in cell E2 of tableau 3 I entered the formula:
=COUNTIF($A$1:$A1,"="&A)
Using fillDown, I filled the column E
I get 0 if the cell a is unique
I get 1 (or higher) if the cell is available several times.
Sort upon column E
delete the rows whose cell E is not 0.
Yvan KOENIG (VALLAURIS, France.) samedi 22 août 2009 11:08:15

Similar Messages

  • First attempt to remove duplicate rows from a table...

    I have seen many people asking for a way to remove duplicate rows from data. I made up a fairly simple script. It adds a column to the table with the cell selected in it, and adds the concatenation of the data to the left into that new column. then it reads that into a list, and walks through that list to find any that are listed twice. Any that are it marks for DELETE.
    It then walks through to find each one marked for delete and removes them (you must go from bottom to top to do this, otherwise your row markings for delete don't match up to the original rows anymore). Last is to delete the column we added.
    tell application "Numbers"
    activate
    tell document 1
    -- DETERMINE THE CURRENT SHEET
    set currentsheetindex to 0
    repeat with i from 1 to the count of sheets
    tell sheet i
    set x to the count of (tables whose selection range is not missing value)
    end tell
    if x is not 0 then
    set the currentsheetindex to i
    exit repeat
    end if
    end repeat
    if the currentsheetindex is 0 then error "No sheet has a selected table."
    -- GET THE TABLE WITH CELLS
    tell sheet currentsheetindex
    set the current_table to the first table whose selection range is not missing value
    end tell
    end tell
    log current_table
    tell current_table
    set list1 to {}
    add column after column (count of columns)
    set z to (count of columns)
    repeat with j from 1 to (count of rows)
    set m to ""
    repeat with i from 1 to (z - 1)
    set m to m & value of (cell i of row j)
    end repeat
    set value of cell z of row j to m
    end repeat
    set MyRange to value of every cell of column z
    repeat with i from 1 to (count of items of MyRange)
    set n to item i of MyRange
    if n is in list1 then
    set end of list1 to "Delete"
    else
    set end of list1 to n
    end if
    end repeat
    repeat with i from (count of items of list1) to 1 by -1
    set n to item i of list1
    if n = "Delete" then remove row i
    end repeat
    remove column z
    end tell
    end tell
    Let me know how it works for y'all, it worked good on my machine, but I know localization is causing errors sometimes when I post things.
    Thanks,
    Jason
    Message was edited by: jaxjason

    Hi jason
    I hope that with the added comments it will be clear.
    Ask if something is always opaque.
    set {current_Range, current_table, current_Sheet, current_Doc} to my getSelection()
    tell application "Numbers09"
    tell document current_Doc to tell sheet current_Sheet to tell table current_table
    set list1 to {}
    add column after column (count of columns)
    set z to (count of columns)
    repeat with j from 1 to (count of rows)
    set m to ""
    tell row j
    repeat with i from 1 to (z - 1)
    set m to m & value of cell i
    end repeat
    set value of cell z to m
    end tell
    end repeat
    set theRange to value of every cell of column z
    repeat with i from (count of items of theRange) to 1 by -1
    (* As I scan the table backwards (starting from the bottom row),
    I may remove a row immediately when I discover that it is a duplicate *)
    set n to item i of theRange
    if n is in list1 then
    remove row i
    else
    set end of list1 to n
    end if
    end repeat
    remove column z
    end tell
    end tell
    --=====
    on getSelection()
    local _, theRange, theTable, theSheet, theDoc, errMsg, errNum
    tell application "Numbers09" to tell document 1
    set theSheet to ""
    repeat with i from 1 to the count of sheets
    tell sheet i
    set x to the count of tables
    if x > 0 then
    repeat with y from 1 to x
    (* Open a trap to catch the selection range.
    The structure of this item
    «class
    can't be coerced as text.
    So, when the instruction (selection range of table y) as text
    receive 'missing value' it behaves correctly and the lup continue.
    But, when it receive THE true selection range, it generates an error
    whose message is errMsg and number is errNum.
    We grab them just after the on error instruction *)
    try
    (selection range of table y) as text
    on error errMsg number errNum (*
    As we reached THE selection range, we are here.
    We grab the errMsg here. In French it looks like:
    "Impossible de transformer «class
    The handler cuts it in pieces using quots as delimiters.
    item 1 (_) "Impossible de transformer «class » "
    item 2 (theRange) "A2:M25"
    item 3 (_) " of «class NmTb» "
    item 4 (theTable) "Tableau 1"
    item 5 (_) " of «class NmSh» "
    item 6 (theSheet) "Feuille 1"
    item 7 (_) " of document "
    item 8 (theDoc) "Sans titre"
    item 9 ( I drop it ) " of application "
    item 10 ( I drop it ) "Numbers"
    item 11 (I drop it ) " en type string."
    I grab these items in the list
    {_, theRange, _, theTable, _, theSheet, _, theDoc}
    Yes, underscore is a valid name of variable.
    I often uses it when I want to drop something.
    An alternate way would be to code:
    set ll to my decoupe(errMsg, quote)
    set theRange to item 2 of ll
    set theTable to item 4 of ll
    set theSheet to item 8 of ll
    set theDoc to item 10 of ll
    it works exactly the same but it's not so elegant.
    set {_, theRange, _, theTable, _, theSheet, _, theDoc} to my decoupe(errMsg, quote)
    exit repeat (*
    as we grabbed the interesting datas, we exit the lup indexed by y.*)
    end try
    end repeat -- y
    if theSheet > "" then exit repeat (*
    If we are here after grabbing the datas, theSheet is not "" so we exit the lup indexed by i *)
    end if
    end tell -- sheet
    end repeat -- i
    (* We may arrive here with two kinds of results.
    if we grabbed a selection, theSheet is something like "Feuille 1"
    if we didn't grabbed a selection, theSheet is the "" defined on entry
    and we generate an error which is not trapped so it stops the program *)
    if theSheet = "" then error "No sheet has a selected table."
    end tell -- document
    (* Now, we send to the caller the interesting datas :
    theRange "A2:M25"
    theTable "Tableau 1"
    theSheet "Feuille 1"
    theDoc "Sans titre" *)
    return {theRange, theTable, theSheet, theDoc}
    end getSelection
    --=====
    on decoupe(t, d)
    local l
    set AppleScript's text item delimiters to d (*
    Cut the text t in pieces using d as delimiter *)
    set l to text items of t
    set AppleScript's text item delimiters to "" (*
    Resets the delimiters to the standard value. *)
    (* Send the list to the caller *)
    return l
    end decoupe
    --=====
    Have fun
    And if it's not clear enough, you may ask for more explanations.
    Yvan KOENIG (from FRANCE mardi 27 janvier 2009 21:49:19)

  • Removing duplicate rows from SELECT

    Hi, I was wondering if there was any way to remove duplicate rows from a select statement.
    My table looks like this:
    CREATE TABLE CUS_ID_TO_PC_ID (
    CUSTOMER_ID VARCHAR2 (10) NOT NULL,
    PC_ID VARCHAR2 (25) NOT NULL,
    PASSWORD VARCHAR2 (25) NOT NULL,
    REG_DATE DATE,
    PRODUCT_DESC VARCHAR2 (25),
    EXPIRE_DATE DATE,
    SERIAL_NBR VARCHAR2 (12),
    LDAP_USER VARCHAR2 (200),
    COMMENTS VARCHAR2 (2000),
    PC_ID_5_4 VARCHAR2 (25),
    PC_ID_6_0 VARCHAR2 (25),
    PASSWORD_5_4 VARCHAR2 (25),
    PASSWORD_6_0 VARCHAR2 (25),
    PC_ID_6_1 VARCHAR2 (25),
    PASSWORD_6_1 VARCHAR2 (25),
    OPERATING_SYSTEM VARCHAR2 (20),
    STATUS VARCHAR2 (1)
    Basically, I want to retrieve all columns from the table but remove all duplicate variations of
    the pc_id/serial_nbr combinations.
    For example, given this data:
    PC_ID SERIAL_NBR CUSTOMER_NO
    1234567 AAA C345
    1234567 AAA C567
    3333333 BBB C456
    only the 1st and 3rd rows would be returned.
    Any ideas?

    Try something like this:
    select * from your_table yt
    where rowid in (select max(rowid)
    from your_tabel yt2
    where yt2.pc_id = yt.pc_id
    and yt2.serial_nbr = yt.serial_nbr);

  • Need to Remove Duplicate Rows

    I have two tables MEMBER_ADRESS and MEMBER_ORDER. The MEMBER_ADRESS has duplicate rows in it based on MEMBER_ID and MATCH_VALUE. These duplicate ADDRESS_IDs were used in MEMBER_ORDER. I need to remove the duplicates from MEMBER_ADRESS making sure I keep the one with PRIMARY_FLAG = ‘Y’ and update MEMBER_ORDER.ADDRESS_ID to the MEMBER_ADRESS.ADDRESS_ID that I kept.
    I am on 11gR1
    Thanks for the help.
    CREATE TABLE MEMBER_ADRESS
      ADDRESS_ID               NUMBER,
      MEMBER_ID                NUMBER,
      ADDRESS_1                VARCHAR2(30 BYTE),
      ADDRESS_2                VARCHAR2(30 BYTE),
      CITY                     VARCHAR2(25 BYTE),
      STATE                    VARCHAR2(2 BYTE),
      ZIPCODE                  VARCHAR2(10 BYTE),
      CREATION_DATE            DATE,
      LAST_UPDATE_DATE         DATE,
      PRIMARY_FLAG             CHAR(1 BYTE),
      ADDITIONAL_COMPANY_INFO  VARCHAR2(40 BYTE),
      MATCH_VALUE              NUMBER(38) GENERATED ALWAYS AS (TO_NUMBER( REGEXP_REPLACE ("ADDITIONAL_COMPANY_INFO"||"ADDRESS_1"||"ADDRESS_2"||"CITY"||"STATE"||"ZIPCODE",'[^[:digit:]]')))
    Insert into MEMBER_ADRESS
       (ADDRESS_ID, MEMBER_ID, ADDRESS_1, ZIPCODE, CREATION_DATE, LAST_UPDATE_DATE, PRIMARY_FLAG, MATCH_VALUE)
    Values
       (200, 30, '11 Hourse Rd.',
        '58754', TO_DATE('08/11/2011 10:56:25', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('08/12/2011 10:34:10', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 1158754);
    Insert into MEMBER_ADRESS
       (ADDRESS_ID, MEMBER_ID, ADDRESS_1, ZIPCODE, CREATION_DATE, LAST_UPDATE_DATE, PRIMARY_FLAG, MATCH_VALUE)
    Values
       (230, 12, '101 Banks St',
        '58487', TO_DATE('08/11/2011 10:56:25', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('08/12/2011 10:35:42', 'MM/DD/YYYY HH24:MI:SS'), 'N', 10158487);
    Insert into MEMBER_ADRESS
       (ADDRESS_ID, MEMBER_ID, ADDRESS_1, ZIPCODE, CREATION_DATE, LAST_UPDATE_DATE, PRIMARY_FLAG, MATCH_VALUE)
    Values
       (232, 12, '101 Banks Street',
        '58487', TO_DATE('08/11/2011 10:56:25', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('08/12/2011 10:41:15', 'MM/DD/YYYY HH24:MI:SS'), 'N', 10158487);
    Insert into MEMBER_ADRESS
       (ADDRESS_ID, MEMBER_ID, ADDRESS_1, ZIPCODE, CREATION_DATE, LAST_UPDATE_DATE, PRIMARY_FLAG, MATCH_VALUE)
    Values
       (228, 12, '101 Banks St.',
        '58487', TO_DATE('08/11/2011 10:56:25', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('08/12/2011 10:38:19', 'MM/DD/YYYY HH24:MI:SS'), 'N', 10158487);
    Insert into MEMBER_ADRESS
       (ADDRESS_ID, MEMBER_ID, ADDRESS_1, ZIPCODE, CREATION_DATE, LAST_UPDATE_DATE, PRIMARY_FLAG, MATCH_VALUE)
    Values
       (221, 25, '881 Green Road',
        '58887', TO_DATE('08/11/2011 10:56:25', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('08/12/2011 10:34:18', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 88158887);
    Insert into MEMBER_ADRESS
       (ADDRESS_ID, MEMBER_ID, ADDRESS_1, ZIPCODE, CREATION_DATE, LAST_UPDATE_DATE, PRIMARY_FLAG, MATCH_VALUE)
    Values
       (278, 28, '2811 Brown St.',
        '58224', TO_DATE('08/11/2011 10:56:25', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('08/12/2011 10:36:11', 'MM/DD/YYYY HH24:MI:SS'), 'N', 281158224);
    Insert into MEMBER_ADRESS
       (ADDRESS_ID, MEMBER_ID, ADDRESS_1, ZIPCODE, CREATION_DATE, LAST_UPDATE_DATE, PRIMARY_FLAG, MATCH_VALUE)
    Values
       (280, 28, '2811 Brown Street',
        '58224', TO_DATE('08/11/2011 10:56:25', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('08/12/2011 10:45:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 281158224);
    Insert into MEMBER_ADRESS
       (ADDRESS_ID, MEMBER_ID, ADDRESS_1, ADDRESS_2, ZIPCODE, CREATION_DATE, LAST_UPDATE_DATE, PRIMARY_FLAG, MATCH_VALUE)
    Values
       (300, 12, '3421 West North Street', 'x',
        '58488', TO_DATE('08/11/2011 10:56:25', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('08/12/2011 10:42:04', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 342158488);
    COMMIT;
    CREATE TABLE MEMBER_ORDER
      ORDER_ID    NUMBER,
      ADDRESS_ID  NUMBER,
      MEMBER_ID   NUMBER
    Insert into MEMBER_ORDER
       (ORDER_ID, ADDRESS_ID, MEMBER_ID)
    Values
       (3, 200, 30);
    Insert into MEMBER_ORDER
       (ORDER_ID, ADDRESS_ID, MEMBER_ID)
    Values
       (4, 230, 12);
    Insert into MEMBER_ORDER
       (ORDER_ID, ADDRESS_ID, MEMBER_ID)
    Values
       (5, 228, 12);
    Insert into MEMBER_ORDER
       (ORDER_ID, ADDRESS_ID, MEMBER_ID)
    Values
       (6, 278, 28);
    Insert into MEMBER_ORDER
       (ORDER_ID, ADDRESS_ID, MEMBER_ID)
    Values
       (8, 278, 28);
    Insert into MEMBER_ORDER
       (ORDER_ID, ADDRESS_ID, MEMBER_ID)
    Values
       (10, 230, 12);
    COMMIT;

    Hi John;
    Sorry I missed your post. Yes sorry about the flag. Please take a look as these before and after sets. I hope this helps. I should have posted this in the begining.
    MEMBER_ORDER (BEFORE)
    ORDER_ID  ADDRESS_ID  MEMEBER_ID
    4       228           12
    10       230           12
    5       230           12
    11       232           12
    12       300           12
    8       278           28
    6       278           28
    3       200           30
    MEMBER_ORDER (AFTER)
    ORDER_ID  ADDRESS_ID  MEMEBER_ID
    4       232           12
    10       232           12
    5       232           12
    11       232           12
    12       300           12
    8       280           28
    6       280           28
    3       200           30
    MEMBER_ADDRESS (BEFORE)
    ADDRESS_ID  MEMBER_ID  ADDRESS_1                    CREATION_DATE             LAST_UPDATE_DATE   PRIMARY_FLAG  MATCH_VALUE
    228         12           101 Banks St.                  8/11/2000 10:56:25 AM     8/12/2005 10:38:19 AM     N     10158487
    230         12           101 Banks St                   8/11/2000 10:56:25 AM     8/12/2006 10:35:42 AM     N     10158487
    232         12           101 Banks Street             8/11/2000 10:56:25 AM     8/12/2007 10:41:15 AM     N     10158487
    300         12           3421 West North Street       8/11/2000 10:56:25 AM     8/12/2011 10:42:04 AM     Y     342158488
    221         25           881 Green Road               8/11/2000 10:56:25 AM     8/12/2011 10:34:18 AM     Y     88158887
    278         28           2811 Brown St.               8/11/2000 10:56:25 AM     8/12/2006 10:36:11 AM     N     281158224
    280         28           2811 Brown Street               8/11/2000 10:56:25 AM     8/12/2011 10:45:00 AM     Y     281158224
    200         30           11 Hourse Rd.                  8/11/2000 10:56:25 AM     8/12/2005 10:34:10 AM     Y     1158754
    MEMBER_ADDRESS (AFTER)
    ADDRESS_ID  MEMBER_ID  ADDRESS_1                    CREATION_DATE             LAST_UPDATE_DATE    PRIMARY_FLAG  MATCH_VALUE
    232         12           101 Banks Street                8/11/2000 10:56:25 AM     8/12/2007 10:41:15 AM     N     10158487
    300         12           3421 West North Street       8/11/2000 10:56:25 AM     8/12/2011 10:42:04 AM     Y     342158488
    221         25           881 Green Road                8/11/2000 10:56:25 AM     8/12/2011 10:34:18 AM     Y     88158887
    280         28           2811 Brown Street              8/11/2000 10:56:25 AM     8/12/2011 10:45:00 AM     Y     281158224
    200         30           11 Hourse Rd.                8/11/2000 10:56:25 AM     8/12/2005 10:34:10 AM     Y     1158754

  • Macro to remove duplicate rows between two worksheets

    Hi
    We have a master file which multiple users access through 'sharepoint'.
    The 'sharepoint' service had an issue, and this master file (which two users spend a day each working on) has not updated.
    We are left with two variations of the same master file, and need to merge them together - allowing adjustments made by both users to stand. The master has 45 columns, and the copies have between 20916 and 21034 rows inc header.
    As I have basic capabilities with Macro's, would someone be able to advise?
    Kind regards
    Metakio

    Re:  Merging two files
    One way...
    In a new workbook, paste copies of the two sets of data onto a single sheet with one set of data directly below the other.
    Use Excel's Remove Duplicates feature to remove the duplicate rows.
    Jim Cone
    Portland, Oregon USA
    free & commercial excel programs
    https://jumpshare.com/b/O5FC6LaBQ6U3UPXjOmX2

  • Need to remove duplicate rows from a table

    Hi Gurus ,
    I am using oracle 11.2.0.3 .
    SQL> desc osstage.S_EVT_ACT_X;
    Name                                      Null?    Type
    ROW_ID                                    NOT NULL VARCHAR2(15 CHAR)
    LAST_UPD                                  NOT NULL DATE
    PAR_ROW_ID                                NOT NULL VARCHAR2(15 CHAR)
    ATTRIB_17                                          NUMBER(22,7)
    ATTRIB_26                                          DATE
    ATTRIB_02                                          VARCHAR2(100 CHAR)
    PROCESS_TIMESTAMP                                  TIMESTAMP(6);
    now when i give the below command it gives the error as someone has disabled the constraint accidently .
    alter table s_evt_act_x enable constraint S_EVT_ACT_X_P1;
    Error starting at line 3 in command:
    alter table s_evt_act_x enable constraint S_EVT_ACT_X_P1
    Error report:
    SQL Error: ORA-02437: cannot validate (OSSTAGE.S_EVT_ACT_X_P1) - primary key violated
    02437. 00000 -  "cannot validate (%s.%s) - primary key violated"
    *Cause:    attempted to validate a primary key with duplicate values or null
               values.
    *Action:   remove the duplicates and null values before enabling a primary
               key.
    Can you please guide me with this issue .

    Please refer
    Script: Deleting Duplicate Rows from a Table (Doc ID 31413.1)
    How to Find or Delete Duplicate Rows in a Table (Doc ID 1004425.6)

  • Remove duplicate rows

    If any duplicate rows exist in the table I wanna delete the oldest rows between 2007-01-01 and 2007-12-31. The latest row I wanna keep. Is this the right way to do this:
    Delete from tblSalesInfo
    Where ROWID NOT IN (SELECT Max(ROWID) FROM tblSalesInfo  GROUP BY salesorder, salesorder_item, orderquantity, line)
    And rec_date between to_date('2007-01-01','yyyy-mm-dd') And to_date('2007-12-31','yyyy-mm-dd')
    And comments Is Null;

    Ok, perhaps i should have explained what i sent you does.
    The inner most select partitions out the data into "groups" much like your group by clause does. It assigns a number to each row 1, 2, 3, ..... N over that partition, when a new partition comes about it starts ordering the data again.
    for example.....
    ME_XE?create table test (column1 varchar2(10), column2 varchar2(20));
    Table created.
    Elapsed: 00:00:00.04
    ME_XE?insert into test values ('row1', 'not a dup yet');
    1 row created.
    Elapsed: 00:00:00.00
    ME_XE?insert into test values ('row1', 'dup');
    1 row created.
    Elapsed: 00:00:00.00
    ME_XE?insert into test values ('row2', 'all alone');
    1 row created.
    Elapsed: 00:00:00.00
    ME_XE?
    ME_XE?select row_number() over (partition by column1 order by column2 asc) as THE_ROWNUMBER, column1, column2
      2  from test;
         THE_ROWNUMBER COLUMN1                        COLUMN2
                     1 row1                           dup
                     2 row1                           not a dup yet
                     1 row2                           all alone
    3 rows selected.
    Elapsed: 00:00:00.01So what you want to do in order to identify duplicates is say
    1) assign a row number to each set of values that i define to be a duplicate
    2) keep all the rowids that are duplicates
    3) delete from the table where the ROWID matches all the kept rowids from step 2.
    make more sense?

  • Special case of removing duplicate rows ...

    There is small issse that we are facing in SQL.
    We have a table say A which has a two column ACOL1 and ACOL2.
    The datatype of ACOL1 column is char(6). This column also has a PK constraint on it. The ACOL2 has a varchar2 datatype.
    Table A contains values like:
    ACOL1 | ACOL2
    12345 | Check the BOL rate
    012345 | not_in_use.
    Now we want to change the COL1 datatype to number(6). We take a backup of this table , disable the PK constraint on COL1,change the datatype of COL1, insert into this table from the backup and enable the PK. It gives a PK violation message which it should. So far so good.
    To remove the duplicate values in the table before enabling the PK we used the following query:
    delete from A t1
    where exists (select 'x' from A t2
    where t2.message_id = t1.message_id
    and t2.rowid > t1.rowid)
    This SQL removes the duplicate COL1 value but the PROBLEM is that it does so randomly and what we need is to just delete that duplicate record which starts with zero.
    But while changing the datatype of the COL1 to number and copying from the backup table into table A , the leading zero get automatically truncated.
    How can we delete only that duplicate record which start with 0 like 012345 in the above given scenario?
    Thanks for your help.

    This should work for you, assign row number based on the PK value, then order by the first character of the PK.
    NOTE: if you have more instances (say 3) of the identical PK value you may want to do some modifications to this...
    ME_XE?create table Test_1
    2 (
    3 col1 varchar2(10) primary key,
    4 col2 varchar2(10)
    5 );
    Table created.
    Elapsed: 00:00:00.09
    ME_XE?
    ME_XE?insert into Test_1 (col1, col2) values ('123', 'Important');
    1 row created.
    Elapsed: 00:00:00.06
    ME_XE?insert into Test_1 (col1, col2) values ('0123', 'Not Imp');
    1 row created.
    Elapsed: 00:00:00.06
    ME_XE?insert into Test_1 (col1, col2) values ('01299', 'keeper');
    1 row created.
    Elapsed: 00:00:00.09
    ME_XE?
    ME_XE?create table test_2 as
    2 select col1, col2
    3 from
    4 (
    5 select
    6 col1,
    7 col2,
    8 row_number() over (partition by to_number(col1) order by substr(col1, 1, 1) desc) as the_rownum
    9 from test_1
    10 )
    11 where the_rownum = 1;
    Table created.
    Elapsed: 00:00:00.07
    ME_XE?
    ME_XE?drop table test_1;
    Table dropped.
    Elapsed: 00:00:00.12
    ME_XE?alter table test_2 rename to test_1;
    Table altered.
    Elapsed: 00:00:00.06
    ME_XE?select * from test_1;
    COL1 COL2
    123 Important
    01299 keeper
    2 rows selected.
    Elapsed: 00:00:00.15

  • Remove duplicates rows by date (min)

    I customer dimension where the customer can be identified by three kind of numbers different. 
    I have to load this dimension whithout customer duplicates, and the identified number can exist or not.
    for example
    id1    id2    id3       date 
    122  null null      2014/02/01
    122   22 null     2014/02/02
    123    null   333     2014/12/01
    nulll     333 null     2014/12/23
    null     null  333      2014/11/23
    I want first row for each customer, after I need make a ssc type 1.
    the result would is:
    id1    id2    id3       date 
    122   22    null     2014/02/02
    null     null  333      2014/11/23
    nulll    333  null     2014/12/23
    best regards
    thanks, David

    I have a mistake, the result will have be :
    id1    id2    id3       date 
    122  null null      2014/02/01
    null     null  333      2014/11/23
    nulll    333  null     2014/12/23
    sorry

  • Is there a "remove duplicates" script for Numbers?

    Is there an Numbers script that will remove (or flag) duplicates from a list of email addresses?

    No bult in script, although there may be one floating around somewhere in cyberspace.
    Flagging duplicates is pretty easy, though:
    Formula:
    B2, and filled down: =COUNTIF(A,A2)
    Sort the table (descending) on column B ("Count") to bring all the addresses with duplicates to the top.
    Delete the extra copies of each address reporting more than one copy.
    Regards,
    Barry

  • Removing Duplicate Rows from resultSet

    I have a query pulling data from 5 tables in 12 columns. I have rows where all of the data is duplicated with the exception of one date column. How would I go about deleting rows that are duplicates with the exception of this one column? I still need to pull the date from the date column with the Max(date).
    i.e.
    Bob Smith 1 2 3 4 12-Jul-2006
    Bob Smith 1 2 3 4 02-Aug-2006
    Bob Smith 1 2 3 4 21-Jan-2006
    Form this resultset I only want one row
    Thanks.

    this example might be of help.
    SQL> select * from employees;
    YEAR EM NAME       PO
    2001 02 Scott      91
    2001 02 Scott      01
    2001 02 Scott      07
    2001 03 Tom        81
    2001 03 Tom        84
    2001 03 Tom        87
    6 rows selected.
    SQL> select year, empcode, name, position,
      2         row_number() over (partition by year, empcode, name
      3                            order by year, empcode, name, position) as rn
      4    from employees;
    YEAR EM NAME       PO         RN
    2001 02 Scott      01          1
    2001 02 Scott      07          2
    2001 02 Scott      91          3
    2001 03 Tom        81          1
    2001 03 Tom        84          2
    2001 03 Tom        87          3
    6 rows selected.
    SQL> Select year, empcode, name, position
      2    From (Select year, empcode, name, position,
      3                 row_number() over (partition by year, empcode, name
      4                                    order by year, empcode, name, position) as rn
      5            From employees) emp
      6   Where rn = 1;
    YEAR EM NAME       PO
    2001 02 Scott      01
    2001 03 Tom        81
    SQL> Delete From employees
      2   Where rowid in (Select emp.rid
      3                     From (Select year, empcode, name, position,
      4                                  rowid as rid,
      5                                  row_number() over (partition by year, empcode, name
      6                                            order by year, empcode, name, position) as rn
      7                             From employees) emp
      8                    Where emp.rn > 1);
    4 rows deleted.
    SQL> select * from employees;
    YEAR EM NAME       PO
    2001 02 Scott      01
    2001 03 Tom        81
    SQL> if you can post a sample create tables and data it will help us provide you a some solutions.

  • Remove duplicate rows based on latest date

    Hi Julius, There are various ways to achive this but I would think an optimized way of doing it by making use of (Sorter and) an Aggregator transformation(s), see how.. Sort your input records at SQ level if it's a relational source or else use a Sorter tx (that's why I mentioned Sorter tx in braces in abvoe line) to sort the input rows on Stage_ID and Date, both in Ascending order, thus you get the latest date record at the end in the list per common Stage_IDs. Now, connect to Aggregator (must be right next to the sorter in order to not to loose the sorted data), and enable the Group By for Stage_ID port. By nature, aggregator tx will push the last record of the group by port or last record of the complete data set if no group by port mentioned. So, you will get recent row per Stage_ID. Try and get back to us if you have any questions or run into issues,-Rajani

    I have a target table I need to split up: stage_id / date / case / blah / blah100 / 01-jan-2015 / 223 / 32 / 323100 / 01-apr-2015 / 224 / 32 / 322 the stage_id column cannot have more than 1 of the same record, so, i need to keep the latest record (01-apr-2015) in this target table, then remove the old one and put it into a dimension table any suggestions for how to accomplish this? please let me know if more info is needed thanks!

  • Remove Duplicate Rows from Left Outer Join

    Hi All,
    I am new to Oracle..I have two tables as follow:
    TableA(EmpID, Empname)
    TableB(EmpID, DeptID, DeptName). A employee can work in multiple dept.
    table A has 1 row as EmpID 1 and TableB has two rows for EmpID 1.
    I have a search page which takes dept ID as parameter and return employee name...Dept ID is not mandatory feld for Search. If DeptID is passed it should return the employee who belongs to that Dept otherwise it should return 1 employee..
    Now I have used as follow:
    :IN_DEPTID is passed as parameter
    Select EmpName from TableA Left Join tableB on a.EmpID = B.EmpID
    WHERE
    CASE WHEN :IN_DEPTID IS NULL
    IN_DEPTID IS NULL
    ELSE|
    DEPTID = :IN_DEPTID
    Now problem is when Dept ID is passed it correctly returns a row but if no deptid is passed it returns 2 rows but i want ony one row as there is only one employee.
    Please help;
    Edited by: user10239708 on 10 Sep, 2008 12:24 AM
    Edited by: user10239708 on 10 Sep, 2008 12:28 AM

    Try this
    Select
    from
         tableA a
    where
         (exists (select 1 from tableB b where a.empid = b.empid and deptid = :IN_DEPTID )
         or
         :IN_DEPTID is null) you database design is not good you should keep the emp, department mapping in different table.
    Regards
    Singh

  • Need to remove duplicate rows from distinct query

    Hello,
    I have the following query:
    SELECT tiab.abnr abnr, tiab.namn namn, (CAST(tiab.GATUNR||' '||tiab.gata AS VARCHAR2(254))) ADR, tiab.boxpnr boxpnr, tiab.boxort boxort,
              (CAST(tiab.RIKTNRDISPLAY AS VARCHAR2(254))) RIKTNR, (CAST(tiab.TELNRDISPLAY AS VARCHAR2(254))) TELNR,
    DECODE((select count(tior.tigilopnr) from tis.tior where abnr = tiab.abnr and inplnr IN (3797886)),0 ,NULL , 1, tior.tigilopnr, 'N/A') tigilopnr
              FROM tis.tiab
    JOIN tis.tior on tiab.abnr = tior.abnr
              WHERE tior.inplnr IN (3797886)
              ORDER BY tiab.ABNR )
    ORDER BY abnr;
    It returns the following:
         14684940     Pizza Station Inc The     Lafayette     26170      St Marys     304     684-2411     
         15123161     Chris Test     554 Easy St n 43333      Columbus     614     555-5555     
         15123162     Chris Test2     5556 Easy St     43333     Columbus     614     555-5151     2553304 --> keep this one
         15123162     Chris Test2     5556 Easy St     43333     Columbus     614     555-5151     -- not show this
    I have tried several different things as well as looking through the forums but have not found anything that will only give me unique records based only on the first column. This query works fine as long as there
    are not 2 records returned with column1 being identical.
    Final results should look like this:
         14684940     Pizza Station Inc The     Lafayette     26170      St Marys     304     684-2411     
         15123161     Chris Test     554 Easy St n 43333      Columbus     614     555-5555     
         15123162     Chris Test2     5556 Easy St     43333     Columbus     614     555-5151     2553304
    Thanks in advance for the assistance.

    Hello,
    Try:
    SELECT  abnr, namn, ADR,  boxpnr,  boxort,RIKTNR,  TELNR,tigilopnr
      FROM (
    SELECT tiab.abnr abnr, tiab.namn namn, (CAST(tiab.GATUNR||' '||tiab.gata AS VARCHAR2(254))) ADR, tiab.boxpnr boxpnr, tiab.boxort boxort,
    (CAST(tiab.RIKTNRDISPLAY AS VARCHAR2(254))) RIKTNR, (CAST(tiab.TELNRDISPLAY AS VARCHAR2(254))) TELNR,
    DECODE((select count(tior.tigilopnr) from tis.tior where abnr = tiab.abnr and inplnr IN (3797886)),0 ,NULL , 1, tior.tigilopnr, 'N/A') tigilopnr,
    ROW_NUMBER () OVER (PARTITION BY tiab.abnr ORDER BY (CAST(tiab.TELNRDISPLAY AS VARCHAR2(254))) NULLS LAST) row_num
    FROM tis.tiab
    JOIN tis.tior on tiab.abnr = tior.abnr
    WHERE tior.inplnr IN (3797886))
    WHERE row_num <= 1
    ORDER BY abnr;Or, with your current query:
    SELECT  abnr, namn, ADR,  boxpnr,  boxort,RIKTNR,  TELNR,tigilopnr
      FROM (
    SELECT distinct tiab.abnr abnr, tiab.namn namn, (CAST(tiab.GATUNR||' '||tiab.gata AS VARCHAR2(254))) ADR, tiab.boxpnr boxpnr, tiab.boxort boxort,
    (CAST(tiab.RIKTNRDISPLAY AS VARCHAR2(254))) RIKTNR, (CAST(tiab.TELNRDISPLAY AS VARCHAR2(254))) TELNR,
    DECODE((select count(tior.tigilopnr) from tis.tior where abnr = tiab.abnr and inplnr IN (3797886)),0 ,NULL , 1, tior.tigilopnr, 'N/A') tigilopnr,
    ROW_NUMBER () OVER (PARTITION BY tiab.abnr ORDER BY (CAST(tiab.TELNRDISPLAY AS VARCHAR2(254))) NULLS LAST) row_num
    FROM tis.tiab
    JOIN tis.tior on tiab.abnr = tior.abnr
    WHERE tior.inplnr IN (3797886))
    WHERE row_num <= 1
    ORDER BY abnr;

  • How do i remove duplicate records?

    I have a table in which almost all the records have been duplicated. I want to remove the duplicates now. How do i remove them?

    Hi,
    Here is the select stmt which will remove duplicate rows from table.
    delete table_name a
    where rowid not in (select max(rowid) from tablename b where a.rep_col = b.rep_col);
    Hope this Helps.
    Regards,
    Ganesh R

Maybe you are looking for

  • [Oracle 11g] Store filename as VARCHAR2 and its content as XMLType

    Hi all, The version of Oracle used is 11.2.0.3.0. I would like to load a XML file into a table from AIX with a Shell script. Here is the test case table: ALTER  TABLE mytable DROP PRIMARY KEY CASCADE; DROP   TABLE mytable CASCADE CONSTRAINTS; CREATE

  • MyFaces in JDeveloper 10.1.3.0.3 EA1

    I was using the JSCookMenu from MyFaces (ver. 1.0.9) in JDeveloper preview addition 10.1.3.0.2 I am now trying to use JSCookMenu from MyFaces (ver. 1.1.0) in JDeveloper 10.1.3.0.3 EA1. The page loads in IE without the menu, status bar says "done, but

  • Sending data directly from BW To Oracle DW via Open hub Third party tools

    HI All We need to send data from SAP BW 7.0 to Oracle 11g DW. The requirement is to pass data through open hubs. So we wanted to explore the option of directly passing the data from BW to Oracle using third party tools. So i tried to gather informati

  • MacBook Pro running hot after Mt. Lion upgrade

    MacBook Pro mid-2009 2.53 with 8GB RAM and 750GB 7200 rpm harddrive: CPU seems to be running much hotter (>70 degrees C) and fan is the normal 2000 rpm per iStat after upgrading to Mt. Lion 10.8.1 and 10.8.2.  Bottom of laptop near center screen side

  • Reading ibook's with no wifi access?

    can i read an book on ibooks once i've downloaded it in an area where I have no Wifi access?