Friday, July 20, 2012
Insert into without duplicates
INSERT INTO TableDuplicates
(empId)
SELECT empId
FROM TableEmployees
WHERE empId NOT IN (select empId from TableDuplicates)
Get duplicates records in SQL
What are we cooking today? A query to count duplicates
SELECT ColumnX, COUNT(*) as TotalCount
FROM TableY
GROUP BY ColumnX
HAVING COUNT(*) > 1
ORDER BY COUNT(*) DESC
Subscribe to:
Posts (Atom)