user3717899
user3717899

Reputation: 1

SQL Select Query - Removing Duplicates/Misspelled Data

Pulling data from a cmdb into another repository. Problem is the cmdb data has misspelled/duplicate records (e.g., some assets have a Department Name as Marketing, or Markting, or Marketing&amp -- when they are all just in Marketing). Want to run a select query that displays all incorrectly named department records as the single, correct name. Any help on how to approach this?

Upvotes: 0

Views: 616

Answers (3)

shital jadhav
shital jadhav

Reputation: 11

you can use the SELECT DISTINCT statement is used to return only distinct (different) values.

you should use distinct keyword before coloumn names in select statement.

e.g: select distinct name (Coloumn name) from table name;

Upvotes: 0

Cameron Stewart
Cameron Stewart

Reputation: 79

I'm sure this is passed but http://openrefine.org/ would probably help you clean the messy data.

Upvotes: 0

dune
dune

Reputation: 21

You can use CASE in to display "marketing" for its wrong entries. But query can be complicated depending on variations.

Better + easier way is a global search and replace in column. Following article describes it:

http://www.codecandle.com/articles/sql/update/483-sql-update-with-global-search-and-replace.html

Cleaning duplicate rows, following article may help:

http://www.codecandle.com/articles/sql/windowing/503-deleting-duplicate-rows-using-windowing.html

Upvotes: 0

Related Questions