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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top