I have two tables; CREATE TABLE category ( category_id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT, name CHAR(15) NOT NULL, PRIMARY KEY (category_id) ); CREATE TABLE albums ( album_id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT, category_id MEDIUMINT UNSIGNED NOT NULL, PRIMARY KEY (album_id) ); (the other fields are removed for clerity).
What I'm trying to do is to update all records in the albums table where the category_id = 0 with a new id-value found by a SELECT statement in the category table, somethink like: SELECT category_id FROM category WHERE name = 'some name'; UPDATE albums SET category_id='value found from above' WHERE category_id='some value'; But I have not found any way to do this from a script. Any hints from some kind souls out there? -- Jørn Dahl-Stamnes homepage: http://www.dahl-stamnes.net/dahls/ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]