Syed Shariff
Syed Shariff

Reputation: 1

how i can select those records in which same row and in same column value is repeated

like i have a file with attributes or columns fullname, addressln1, city, state, zip and someone just mass up that files and in some records fullname column name come up like "joe joe David" or "syed hashim Ali syed" i just want to select those records and take out from file to fix them can i do that in sql or excell please please help me out Thanx

Upvotes: 0

Views: 74

Answers (1)

Harish Shetty
Harish Shetty

Reputation: 64373

Lets assume you have a column called data_quality in your addresses table.

class Addess < ActiveRecord::Base

  before_save :set_data_quality

  def set_data_quality
   names = self.fullname.downcase.split
   data_quality = "poor" if names.size > names.uniq.size 
  end

end

After the import, the rows with duplicate names will have the column data_quality set to poor.

Upvotes: 2

Related Questions