Question on Query

J

John W

I'm setting up a query that contains two tables that have one field related.
Table A is the main data - the field related to table B will have new codes
added frequently. How do I write a query so that if the code in table A is
not found in table B it will just return a value of "Unknown". The way it
is right now, if the data is not on table B the record is removed from the
query.

Thanks!
 
J

Jerry Whittle

SELECT A.
Code:
,
IIf(IsNull([B].[Code])=True,"Unknown", B.[Code]) AS B_Code
FROM A LEFT JOIN B ON A.[Code]= B.[Code];
 
Top