Wednesday, September 26, 2012

how to get duplicate records from a table in sql server

When i insert the bulk amount data from one table into another table i got problem with existing data.Here in the "products" table the "prod_code" column has already some data of import table(sales_import).For this i have checked the count of redundant(already exists) data in existing table.In this post i have given a query to get the existing data(products) in the table compare to import table(sales_import).
select count(*) from products a where exists
 select  1 from [sale_Import] b where a.prod_code = b.[Title ID]

If you want to get tha data you have to use * instead of count(*)
Post a Comment