Link to home
Start Free TrialLog in
Avatar of Webbo_1980
Webbo_1980

asked on

How do i move a field and its contents to a different table?

I have two tables e.g. Product and ProductNew both are linked via a foreign key call ProductId

However i want to merge the tables into one table?

What the sql for this please?

THanks
Webbo
SOLUTION
Avatar of Olaf Doschke
Olaf Doschke
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Webbo_1980
Webbo_1980

ASKER

Thanks Olaf but so just to make sure i understnad this completly...

I have a table called Product and ProductEx

I want to merge then to be Product

ProductEx Contains subtitle and a foreign key called ProductId

SELECT subtitle INTO Product
FROM Product t1 Full Outer Join Productex t2 On t1.ProductID =t2.ProductID

Is this correct?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Joe obviously has the solution.

But then you just wanted to update data, not create a table or a new field. subtitle already exists in Product and you just want to fill in new data.

If you really wanted to add a field to Product, this isn't possible with INTO your SQL would work if no table Prudct would exist it would create one, but ONLY with the subtitle field, that surely is not what you want.

When you initially said you wanted to merge two tables, I thought of merging table structures in the first place, not merging data.

Bye, Olaf.
Sorry Olaf it was a poor choce of words on my part