View Full Version : find duplicates using LIKE
ironj32
02-01-2008, 10:05 AM
I need to use a query to search for duplicates in a table, but I they might not be spelled Exactly the same. is there a way to search for duplicates in a table, but show records that have the first 3 letters the same?
rconverse
02-01-2008, 10:41 AM
I need to use a query to search for duplicates in a table, but I they might not be spelled Exactly the same. is there a way to search for duplicates in a table, but show records that have the first 3 letters the same?
I created a query that seems to work:
SELECT Left([FieldName],3) AS fldFirstThree, Count(TableName.[FieldName]) AS [CountOfFieldName]
FROM TablebName
GROUP BY Left([FieldName],3);
HTH
Roger
CreganTur
02-01-2008, 01:33 PM
rconverse's answer is great for grouping all data in a table into items sharing first 3 same digits, but if you're only looking for 1 specific item, you can use this:
SELECT [fieldname]
FROM [tablename]
WHERE ([fieldname] LIKE "ABC*") {where ABC represents first 3 letters}
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.