Skip to content

Instantly share code, notes, and snippets.

@clintmjohnson
Last active August 29, 2015 14:23
Show Gist options
  • Select an option

  • Save clintmjohnson/cfbe89181ea518166fe0 to your computer and use it in GitHub Desktop.

Select an option

Save clintmjohnson/cfbe89181ea518166fe0 to your computer and use it in GitHub Desktop.
This Query Filters a SQL Server Table to only Dupicate Values
select o.model_number, oc.model_number
from Product_Staging_Table o
inner join (
SELECT model_number, COUNT(*) AS dupeCount
FROM Product_Staging_Table
GROUP BY model_number
HAVING COUNT(*) > 1
) oc on o.model_number = oc.model_number
WHERE o.model_number <> '' AND o.model_number IS NOT NULL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment