tags:

views:

238

answers:

1

Hello.

I want to merge the field "price" from the table "products" into the field "price" in the table "products_description". Both tables has "products_id" that match.

Can't really get my head around it :(

+2  A: 

Something like:-

UPDATE products_description pd
INNER JOIN products p 
ON p.productid = pd.productid
SET 
    pd.price = p.price;

That will copy the price from table products into products_description! Although it may not be 100% apparent this is what you want.

Rippo
WOW! That was spot on!
Cudos
Well. this may do what he wanted, but shows a very bad flaw in the database design. Duplicated data does not even comply with the first NF.
txwikinger
This depends, why not ask him why he is doing this before citing NF?It may well be duplicated data or it may not. There could be many reasons for this.
Rippo
The reason was that I was moving data from an old database to a new one that have different table design.
Cudos
Thanks Cudos! Good answer.
Rippo