sql - Correct spelling mistakes in a column based on another table in postgresql -


I PostgreSQL table a (cityname) column. (City name) each some spelling mistakes column columns and records (city name) needs to be fixed. Another table is a column are including all the correct city name is based on the table spelling mistakes in the first table needs to be corrected.

A column

table with correct data in Table A (with mistakes) that you need B Can relate to rows in Gives the value to the city_id column which works like this.

  update table_A set table_A Addl = Table_bkcorrect_addl as table_B.city_id joining j_table_A table_B = table_A.city_id where j_table_A.primary_key_column = table_A .primary_key_column   

You basically have a table_A two-time reference. There edit after a good reason, but I've found that if you get to pull the data needed during an update this is the easiest way

comment to this :. Because you have a good way to associate the data that needs fixing (like a city_id) to the right, then you need to work on the condition of joining yourself and maybe introduce a regex. There is a link that can be of some use

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -