felito Posted June 9, 2011 Share Posted June 9, 2011 hi i have this code: INSERT INTO single_user (location_home_id_location_home) SELECT id_location_home FROM location_home WHERE location_home.location = 'London' i am trying convert to an update but i didn't have success any idea? what i am trying: update `database_charts`.`single_user` set `location_home_id_location_home` = id_location_home from location_home where location_home.location = 'London' Quote Link to comment https://forums.phpfreaks.com/topic/238846-convert-insert-to-update/ Share on other sites More sharing options...
felito Posted June 9, 2011 Author Share Posted June 9, 2011 well, this solve my problem update `database_charts`.`single_user` set `location_home_id_location_home` = (SELECT id_location_home FROM location_home WHERE location_home.location = 'London') if anyone know a better way, please share. thanks Quote Link to comment https://forums.phpfreaks.com/topic/238846-convert-insert-to-update/#findComment-1227268 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.