I want to update a field in my table based in another table and I executed this query below but I think it's not right.. it looks like it worked but is it correct? Is there any situation where it might fail?
UPDATE users SET page = (SELECT page_name FROM pages WHERE user_id = id)
Instead of subselect In mysql you can use UPDATE JOIN
UPDATE users INNER JOIN pages on pages.user_id = users.id SET users.page = pages.page_name