title: How to find duplicate fields using SQL?
body: <p>I have table person(id, iin, name, done) and table err_person(id, iin, surname, name). How i can find duplicate values within 'iin' fields. If it exist, copy to err_person table and set flag person.done=1 for these rows.</p>
  
  <p><a href="https://i.stack.imgur.com/3NU8m.png" rel="nofollow noreferrer">person table</a></p>
  
  <p><a href="https://i.stack.imgur.com/H60EZ.png" rel="nofollow noreferrer">desired results: err_person</a></p>