Update multiple rows in a table from another table when condition exists

后端 未结 3 936
说谎
说谎 2021-02-13 17:58

I have two tables.

Table1 contains companies whose locations are georeferenced with lat/lng coordinates in a column called the_geom

3条回答
  •  清酒与你
    2021-02-13 18:41

    If you are a mysql user(like me) and if the above script is not working, here is the mysql equivalent.

    UPDATE table2 t2, table1 t1
    SET    the_geom = t1.the_geom
    WHERE  t2.address = t1.address
    AND    t2.the_geom <> t1.the_geom; -- avoid empty updates
    

    All credits to the OP.

提交回复
热议问题