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.
Asked
Active
Viewed 52 times
1 Answers
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
-
@DanielE. thanks for your comment, but I've used `GROUP BY i.ItemDescription` – StepUp Dec 20 '18 at 09:04
-
@DanielE. Thanks! I've added your comment to the answer. – StepUp Dec 20 '18 at 09:10
-
Thanks all, you guys really good in helping person in need :D – Iman Nungki Kautsar Dec 21 '18 at 01:29