SQL - Updating a table with values from another table
Posted: Tue Mar 20, 2007 12:20 pm
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.
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.