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

Using VB to create a table

Status
Not open for further replies.

goterps1

Technical User
Sep 21, 2006
13
US
I have little experience with VB but I thought I could use a vb script to solve my problem. The outcome I want is to have a script that will run down each row in table A and compare rows to table B. Then print out or create a table with the rows from each table that do not match. (ex. start at row1 in table A. if SSN in table A matches SSN in table B then check to see if address1 matches between table A and table B. if it does not match then print out entire row from table A and entire row from table B)

Both tables have the exact same columns. I was looking for a starting point can anyone help?
 
SQL code:
SELECT A.*, B.*
FROM tableA As A INNER JOIN tableB As B ON A.SSN = B.SSN
WHERE A.Address1 <> B.Address1

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Unfortunately I have a where clause of 5 fields to compare. If 1 field out of the 5 do not match then I want to pull the row from both tables. If all 5 fields match then I want to skip and go to the next row.
 
SELECT A.*, B.*
FROM tableA As A INNER JOIN tableB As B ON A.SSN = B.SSN
WHERE A.Address1 <> B.Address1 OR A.SomeField <> B.SomeField OR A.AnotherField <> B.AnotherField ....

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

Part and Inventory Search

Sponsor

Back
Top