php - MySQL update column with value from second table -


i replace users name in 1 table id, needs referenced table. example:

i have table looks like:

id  |  key  |  value --------------------- 1   |  name |  bob 2   |  name |  bob 3   |  name |  john 

and table b:

id  |  name -------------- 1   |  bob 2   |  rick 3   |  john 

i trying table like:

id  |  key  |  value --------------------- 1   |  name |  1 2   |  name |  1 3   |  name |  3 

how build query in mysql this?

one issue data types. not wise store numbers strings. but, can values want doing:

update join        b        on a.value = b.name     set a.value = b.id; 

Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -