discovering duplicated values through SQL

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello
is it possible to have a SQL statement that will return which records in a table have duplicated values in certain fields
to make it more clear
I have used SQL to populate tables in a database with records coming from another database
Tables in the new databse have primary keys builded on multiple fields
Data coming from the old database will create duplicated values on those fields, so I will receive an error while transferring data
To avoid this I would like to build a SQL statement that will populate a form with records that will create duplicated value on the primary key
Is it possible? Syntax

Thanks
Rocco
 
Try something along the following lines

SELECT O.*
FROM OldTable O INNER JOIN NewTable N ON O.primaryColumn1 =
N.primaryColumn1 AND O.primaryColumn2 = N.primaryColumn2
AND etc for all the primary columns

Hope This Helps
Gerald Stanley MCSD
-----Original Message-----
Hello,
is it possible to have a SQL statement that will return
which records in a table have duplicated values in certain
fields?
to make it more clear:
I have used SQL to populate tables in a database with
records coming from another database.
Tables in the new databse have primary keys builded on multiple fields.
Data coming from the old database will create duplicated
values on those fields, so I will receive an error while
transferring data.
To avoid this I would like to build a SQL statement that
will populate a form with records that will create
duplicated value on the primary key.
 
Back
Top