简体   繁体   中英

Mysql Update Query with three tables

I'm currently try to write an sql statement based on a jointure between three tables, and i keep getting the same error. Here's my code :

UPDATE l SET name=n.title FROM location as l INNER JOIN location_instance as i ON l.lid=i.lid INNER JOIN node as n ON n.nid = i.nid

There are three tables in total : [location: (lid, name )] , [location_instance(nid,lid)] and [node(nid)].

Sorry if my question seems irrelevant to you, I am still a beginner in this field. Thanks

There is no from clause in update

UPDATE location as l
INNER JOIN location_instance as i
ON l.lid=i.lid 
INNER JOIN node as n 
ON n.nid = i.nid
SET l.name=n.title

Please try with this:

UPDATE location as l SET name=n.title 
INNER JOIN location_instance as i ON l.lid=i.lid 
INNER JOIN node as n ON n.nid = i.nid

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM