Page 1 of 1

SQL - Updating a table with values from another table

Posted: Tue Mar 20, 2007 12:20 pm
by keveh
This is a simple error, and I have looked all over these forums and google to try and get it to work, but if refuses to.

Basically i have two tables which are exactly the same, apart from the field names:

pictures
- id
- prod_id
- picture
- default

pictures_prd
- picture_id
- prod_id
- picture_name
- default_img

What i want to do is update the table pictures_prd.default_img to the same value as pictures.default where pictures_prd.prod_id is equal pictures.prod_id

I have tried multiple queries that I have seen on here and on the mysql site.

I was wondering if somebody could give me some SQL that they think will work?

Thanks in advance.

Posted: Tue Mar 20, 2007 12:39 pm
by Burrito
what version of MySQL are you running?

knowing that will help us help you...(whether you can run sub queries or not).

Posted: Wed Mar 21, 2007 5:34 am
by keveh
This is info I've got from MySQL Administrator:

MySQL 4.1.20 via TCP/IP