MYSQL PHP: How to update a column with value in another table?
Posted on 2008-06-13
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.
[ code ] [ category id ] [ category name ]
[ 001 ] [ 50 ] [ ]
[ 002 ] [ 60 ] [ ]
[ 003 ] [ 70 ] [ ]
[ category id ] [ category name ]
[ 50 ] [ Toys ]
[ 60 ] [ Books ]
[ 70 ] [ CD ]
How do I write a mysql query or PHP script to do this?