August 1, 2006 at 10:47 am
Hello everybody !!!
Thanks for all the help you have provided me all this time.
I have been stucked in problem again. To tell you the truth i am not a programmer or DBA and i've very little knowledge of DBMS.
Well i've 2 table. Table-A contains the old values and Table-B contains some New Values. Now want to update the Table-A from Table-B checking one by one record. As there is a PrimeryKey in both the Table.
Table-a contains around 1200 records and 90 fields.
Thats why its painfull to do the entry work again and again.
Please help me
Regards
Neetal Shah
August 1, 2006 at 12:41 pm
So you just want to copy all of your records from table b to table A? If that's the idea have a go with this...
INSERT INTO tableA
--Make sure you change them to your actual column names
SELECT col1, col2, col3 ... col90
FROM tableB
Or if you have some duplicate in B that you already have in a you'd need to make sure you only get the new records. This can be done a number of ways, one of the simplest to explain is...
INSERT INTO tableA A
--Make sure you change them to your actual column names
SELECT b.col1, b.col2, b.col3 ... b.col90
FROM tableB B
WHERE tableB.col1 --or whatever your primary key column is
NOT IN (SELECT DISTINCT col1 FROM tableA)
So you're inserting all rows from table b where the unique identified is not yet present in tableA
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply