-1

I want to find duplicate of single word in my ItemDescription column. Please Look The Picture: https://i.stack.imgur.com/mBX7F.jpg .Not the duplicate value but the duplicate of single word with in the value. Is it Possible? Please help me.

1 Answers1

1

Use LIKE operator to find occurrences of your words and operator GROUP BY and HAVING to find duplicates:

SELECT 
i.ItemDescription 
FROM dbo.tbiitems i
WHERE i.ItemDescription LIKE '%NR%' OR i.ItemDescription LIKE '%NRCONDITIONER%' OR 
i.ItemDescription LIKE '%CREAMBATH%'
GROUP BY i.ItemDescription
HAVING COUNT(i.ItemDescription) > 1

or if you want to find counts of ItemDescription and follow the SQL rules this subject on SO for example (thanks to @Daniel E.):

SELECT 
i.ItemDescription, COUNT(i.ItemDescription) AS CountItemDescription
FROM dbo.tbiitems i
WHERE i.ItemDescription LIKE '%NR%' OR i.ItemDescription LIKE '%NRCONDITIONER%' OR 
i.ItemDescription LIKE '%CREAMBATH%'
GROUP BY i.ItemDescription
HAVING COUNT(i.ItemDescription) > 1
Daniel E.
  • 2,440
  • 1
  • 14
  • 24
StepUp
  • 36,391
  • 15
  • 88
  • 148