I am trying to clean up a database that is suffering from sins of the past...
I have a Description field, and a DescriptionNumber field that should have a 1 to 1 relationship. However due to the above mentioned sins, a single DescriptionNumber may have more than one description assigned to it.
For example
row #1 is | 1 | Cardboard box | blah blah blah
Row #2 is | 1 | Box, Cardboard | blah blah blah
I need a query that will return any DescriptionNumber that has more than one description associated with it.
I have written
SELECT DescriptionNumber, Description
FROM table
GROUP BY DescriptionNumber, Description
ORDER BY DescriptionNumber
This produces a grid which I can review to find duplicate DescriptionNumbers, but the list includes DescriptionNumbers with only a single entry, and it is overwhelming to review manually.
I tried adding HAVING Count(DescriptionNumber) > 1 but that doesn't seem to work.
Thanks for any help.
Start Free Trial