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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Access and SQL Server

Status
Not open for further replies.

takeover

Programmer
Jul 9, 2003
52
US
Gurus,

I have table called Table1 in MS Access with 10 columns and have a similar table, Table2 in SQL Server. I have created the link table from Access to SQL Server. I need to compare the data in Table1 to that of Table2 and find the duplicates and insert the output to a third table in MS Access called Table3. The comparison should be done on 5 columns of Table1 to those of Table2 (Col1, Col2, Col3, Col4, and Col5). If all these 5 columns are matching then only the data should get inserted to Table3.

I am trying to use exists statement, but cannot achieve the desired result. Could anybody help me?

takeover
 
Have you tried an INNER between Table1 and Table2 on the 5 columns ?
INSERT INTO Table3 (field list)
SELECT Field list
FROM Table1 T1 INNER JOIN T2 ON T1.Col1=T2.Col1 And T1.Col2=T2.Col2 ... And T1.Col5=T2.Col5

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top