Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

appending data

Status
Not open for further replies.

747576

Programmer
Jun 18, 2002
97
GB
Hi,

I have a table with data I want to append to another table. The new table (table 2) contains updated records from the original table (table 1). I need to run a query which will use the table 2 to extract the corresponding data from the original table 1 so I can delete the records and append the new records (I dont want to duplicate records). I can query the records using certain fields, ie field1, field2 which will distinguish the records. I've tried a union but need more help.

thanks
 
Select rows in table1 that are on table2.

Select t1.*
From table1 t1
Join table2 t2
On t1.field1=t2.field1
And t1.field2=t2.field2

Delete rows in table1 that are on table2.

Delete table1
From table1 t1
Join table2 t2
On t1.field1=t2.field1
And t1.field2=t2.field2

Terry L. Broadbent - DBA
Computing Links:
faq183-874 contains "Suggestions for Getting Quick and Appropriate Answers" to your questions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top