Page 1 of 1

Migrating Data from One Table to Another Using SQL

Posted: Thu May 24, 2007 9:41 am
by cfytable
I have two tables. I want to migrate the data from Table B into Table A (below). There are no explicit links or key between the two tables, but TextID in Table A corresponds to ID in Table B.

Table A
ID (auto) e.g. 2002
Title e.g. My Article Title
TextID e.g. 38

Table B
ID (auto) e.g. 38
Keywords e.g. Blah, blah, blah
Body e.g. Article text

Can this be accomplished via SQL? Is it possible to insert selected data along the lines below? If so, can someday advise me on the proper syntax? Any help would be appreciated.

(This assumes that I've created the corresponding columns in Table A)

INSERT INTO TableA (Keywords, Body) VALUES (??????) WHERE TableA.TextID = TableB.ID

Posted: Thu May 24, 2007 10:00 am
by feyd
Look at the syntax for INSERT ... SELECT