0

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?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129

3 Answers3

0

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

dune
  • 21
  • 1
  • 4
0

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

0

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;