Have you ever needed to identify records in a file that are duplicate records and struggled to find an elegant,...
By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
simple and quick solution without having to write a program every time?
Use the GROUP and COUNT(*) features of SQL together to identify the duplicate records in no time...
Include the key fields in both the SELECT and the GROUP fields (in the same order). The key fields are whatever fields are required to make the definition of 'duplicate' unique to your situation.
Don't forget that you can redirect the output of your SQL operations to a file or a report using the F13=Services and option 1 to Change session attributes.
SELECT CONO, ITEM, Count(*)
GROUP BY CONO, ITEM
HAVING count(*) > 1