MySQL Forums
Forum List  »  Newbie

Updating a table from another with like
Posted by: dan t
Date: August 22, 2005 12:11PM

Hello Everyone,

I am trying to update one table called categories, the column catagories_image from the table called catagories_description where the column catagories_name is "something"

Basicly, I have named a catagory something, and an image the same thing, Based on the catagory name, I need the field "catagories_image" to change based on the catagories name

Here is the code I have that is not working, I have done alot of searching and see alot about JOIN and such, but am not sure its what i need



update categories
set categories_image = 'accessories.jpg'
from categories_description
WHERE categories_name like 'Accessories'




As you can see. Any field with the name accessories in the table categories_description, I want the catagories_image in the table catagories to change to accessories.jpg.

I did it in the same table based on the catagories_id, but there are over 100, different numbers. And it would take forever to put them all in a single statement. And there are over 50 total catagories I will need to do this to.

If anyone could help out, It would really help me out!!
Thanks in advance, and I really appreciate it!
Dan Termani
http://TermaniMotorsports.com

Options: ReplyQuote


Subject
Written By
Posted
Updating a table from another with like
August 22, 2005 12:11PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.