2 Replies Latest reply on Apr 23, 2008 7:23 AM by Arun Kumar Gupta

    Find duplicate values in a table based on combination of two columns.

    user555994
      In table which have millions of records -
      I have a Table B under Schema A and i have to find the duplicate records in a table. My Table B uses the combination of columns to identify the unique values.
      Scenario is something like this-
      One SV_Id can have multiple SV_Details_Id and i have to find out if there is any duplicate in the table. (I have to use combination of columns to identify the unique values and there is no Primary Key, Foreign Key or Unique Key on the table)

      then wrote the following query -
      select SV_Id,SV_Details_Id count (*) from SchemaA.TableB group by SV_Id,SV_Details_Id having Count (*) > 1 ;

      Is it correct as after firing the above query it is returning the rows which is not matching to the duplicate.

      kindly help me.
      Looking forward for some guidance -
      Thanks in advance.