hyster Posted November 17, 2010 Share Posted November 17, 2010 im trying to up date a column from 1 table from another and i have no idea where to start. ive spent hours serching google and not found what im after. i have 2 tables dsgi_serval = (id - sku - rsku - * - * - * - * - * - * - * - *) (* = other columns) dsgi_trans = (id - sku - rsku) what i need to do is replace dsgi_serval.rsku with the column in dsgi_trans.rsku where dsgi_serval.sku = dsgi_trans.sku the 2 tables are in mysql database and i wanted to use the sql tab in phpmyadmin to do this. any suggestions please Quote Link to comment https://forums.phpfreaks.com/topic/219006-update-column/ Share on other sites More sharing options...
mikosiko Posted November 17, 2010 Share Posted November 17, 2010 well... you first source should be: http://dev.mysql.com/doc/refman/5.0/en/update.html there are some examples... and also you can follow the links on that page and you should be able to figure out how to do it.... and the easy... "instant gratification" way UPDATE table1 t1 JOIN table2 t2 ON t1.id = t2.id SET t1.col1 = t2.col2, t1.col2 = t2.col2 Quote Link to comment https://forums.phpfreaks.com/topic/219006-update-column/#findComment-1135776 Share on other sites More sharing options...
hyster Posted November 17, 2010 Author Share Posted November 17, 2010 thanks miko. i did find that page but i didnt understand it. i managed to alter the code u posted and it worked a treat. update dsgi_serval JOIN dsgi_trans ON dsgi_serval.sku=dsgi_trans.sku SET dsgi_serval.sku = dsgi_trans.sku, dsgi_serval.rsku = dsgi_trans.rsku Quote Link to comment https://forums.phpfreaks.com/topic/219006-update-column/#findComment-1135786 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.