Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/219006-update-column/
Share on other sites

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  :D

 

UPDATE table1 t1 JOIN table2 t2 ON t1.id = t2.id
SET t1.col1 = t2.col2, t1.col2 = t2.col2

Link to comment
https://forums.phpfreaks.com/topic/219006-update-column/#findComment-1135776
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/219006-update-column/#findComment-1135786
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.