Wednesday, 28 February 2018

Microsoft SQL Retrieve Duplicates based duplicates in one column

Microsoft SQL Retrieve Duplicates based duplicates in one column

-- The subquery on the same table is used to find dulicates in a table based on one column
-- Duplicates can also be found across more than one column by using concatenatiom

SELECT *
  FROM [test].[dbo].[options on fx majorsii]
  where [product] in

  (select product
  FROM [test].[dbo].[options on fx majorsii]
  group by product
  having count([product])>1);


Inline image 1

No comments:

Post a Comment