Table Compare with extra's

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have two tables:

tblPrimary:
Unkey CustCodeA
1 202
2 207
3 209

tblSecondary
Unkey CustCodeB
1 202
2 255
3 209

I want to output all records in tblPrimary and the output table to have the
following fields:

tblOutput
Unkey CustCodeA
1 Match
2 Error - 255
3 Match

Prefer solution in query builder, if possible.

Appreciate any help.
 
Mackia said:
I have two tables:

tblPrimary:
Unkey CustCodeA
1 202
2 207
3 209

tblSecondary
Unkey CustCodeB
1 202
2 255
3 209

I want to output all records in tblPrimary and the output table to have the
following fields:

tblOutput
Unkey CustCodeA
1 Match
2 Error - 255
3 Match


SELECT tblPrimary.Unkey,
IIf(tblPrimary.CustCodeA = tblSecondary.CustCodeB,
"Match", "Error - " & tblSecondary.CustCodeB) As CodeA
FROM tblPrimary INNER JOIN tblSecondary
ON tblPrimary.Unkey = tblSecondary.Unkey
 
Back
Top