gingera
asked on
MYSQL PHP: How to update a column with value in another table?
PHP MYSQL
Hello,
How do I insert value into a column based on value from another table?
For example, I want to insert the Category Name into all rows in TABLE 1, by checking their Category ID and obtaining the Category Name from TABLE 2.
TABLE 1
[ code ] [ category id ] [ category name ]
[ 001 ] [ 50 ] [ ]
[ 002 ] [ 60 ] [ ]
[ 003 ] [ 70 ] [ ]
TABLE 2
[ category id ] [ category name ]
[ 50 ] [ Toys ]
[ 60 ] [ Books ]
[ 70 ] [ CD ]
How do I write a mysql query or PHP script to do this?
Thanks.
Hello,
How do I insert value into a column based on value from another table?
For example, I want to insert the Category Name into all rows in TABLE 1, by checking their Category ID and obtaining the Category Name from TABLE 2.
TABLE 1
[ code ] [ category id ] [ category name ]
[ 001 ] [ 50 ] [ ]
[ 002 ] [ 60 ] [ ]
[ 003 ] [ 70 ] [ ]
TABLE 2
[ category id ] [ category name ]
[ 50 ] [ Toys ]
[ 60 ] [ Books ]
[ 70 ] [ CD ]
How do I write a mysql query or PHP script to do this?
Thanks.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER