Default Query results.

J

jlepack

I have this query:

SELECT tblA.*, tblB.cID
FROM tblA LEFT JOIN tblB ON tblA.fNum = tblB.fNum;

Now I want to see all the records from tblA and the cID from tblB if
there is one. Now if there isn't a matching cID I want it's value to
not be blank. I want it to be "Does Not Exist".

How do I do that? Solution referably in Query design view.
 
J

John Spencer

SELECT tblA.*
, IIF(tblB.cID is Null,"Does Not Exist",tblB.cID) as cID
FROM tblA LEFT JOIN tblB ON tblA.fNum = tblB.fNum;

Or use the Visual Basic NZ function.
SELECT tblA.*, Nz(tblB.cID,"Does Not Exist") as C_id
FROM tblA LEFT JOIN tblB ON tblA.fNum = tblB.fNum;
 
J

jlepack

Thank you very much.

John said:
SELECT tblA.*
, IIF(tblB.cID is Null,"Does Not Exist",tblB.cID) as cID
FROM tblA LEFT JOIN tblB ON tblA.fNum = tblB.fNum;

Or use the Visual Basic NZ function.
SELECT tblA.*, Nz(tblB.cID,"Does Not Exist") as C_id
FROM tblA LEFT JOIN tblB ON tblA.fNum = tblB.fNum;
 

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

Top