I get an issue using update
and inner join
with MYSQL.
I need to concat properties using another table.
My query :
update cfc_registration
set teams = concat(r.teams, " - ", u.firstname, " ", u.lastname)
from cfc_registration as r
inner join cfc_user as u
on r.cfcUserId = u.id
where r.cfcTournamentId = 5
Error message :
#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 cfc_registration as r inner join cfc_user as u on r.cfcUserId = u.id whe' at line 3
Not sure FROM
and INNER JOIN
can be used in an update query. Try this instead:
update cfc_registration r, cfc_user u
set teams = concat(r.teams, " - ", u.firstname, " ", u.lastname)
where r.cfcTournamentId = 5 and r.cfcUserId = u.id
Try this
UPDATE cfc_registration as r
inner join cfc_user as u
on r.cfcUserId = u.id
and r.cfcTournamentId = 5 set teams = concat(r.teams, " - ", u.firstname, " ", u.lastname)
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.