这会导致返回行的原因:
select users.user_fullname,concat(persons.first_name,' ',persons.last_name)
from users, persons
where users.user_id = persons.user_id
and users.user_fullname = '0'
然而这引发了语法错误?
update users
set users.user_fullname = concat(persons.first_name,' ',persons.last_name)
from users, persons
where users.user_id = persons.user_id
and users.user_fullname = '0'
答案 0 :(得分:3)
它与CONCAT
无关。问题是您不应在UPDATE
语句中使用FROM
子句。
UPDATE users, persons
SET users.user_fullname = CONCAT(persons.first_name,' ',persons.last_name)
WHERE users.user_id = persons.user_id
AND users.user_fullname = '0'