I have the following MySQL update statement that is failing:
update us
set us.name = concat('user_',rpc.userid),us.addr='old_user'
from user us
join (select distinct(h.userid) as userid,max(h.rpc_time) as rpc_time from host h
join user u on u.id = h.userid group by h.userid order by h.userid) as rpc
on us.id = rpc.userid and rpc.rpc_time < 1070236800;
Gets the following error message:
Error message: ERROR 1064 (42000): 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 user us join (select distinct(h.userid) as userid,max(h.rpc_'
I think it might be due to the underscore. Any ideas on how to solve this or get around this?