-2
UPDATE jos_ezrealty

  SET jos_ezrealty.locid = p.id

,jos_ezrealty.locality = p.locality

,jos_ezrealty.owncoords = 1

FROM poblacion p

  WHERE jos_ezrealty.alias LIKE '%' || p.locality || '%'

它给了我:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM poblacion p WHERE jos_ezrealty.alias LIKE '%' || p.locality || '%'' at line 5

4

2 回答 2

2

阅读UPDATEMySQL 的语法

UPDATE jos_ezrealty AS e
  JOIN poblacion p
    ON e.alias LIKE '%' || p.locality || '%'
SET e.locid = p.id
  , e.locality = p.locality
  , e.owncoords = 1 ;
于 2012-05-22T11:40:31.747 回答
1

它应该是这样的:

UPDATE jos_ezrealty join poblacion 

SET jos_ezrealty.locid = p.id

,jos_ezrealty.locality = p.locality

,jos_ezrealty.owncoords = 1

WHERE jos_ezrealty.alias LIKE CONCAT('%', p.locality, '%');
于 2012-05-22T11:46:53.807 回答