Dear All,
I got a query where I would like to select the clientName from tblClient but with condition that this clientID does not exist in another table call tblCDSValidity. I tried like this but it failed.

SELECT tblClient.clientID, tblClient.clientName FROM tblClient,tblCDSValidity Where tblClient.clientStatus='a' And tblClient.clientID!=tblCDSValidity.clientID ORDER BY tblClient.clientName

Recommended Answers

All 6 Replies

SELECT clientID, clientName 
FROM tblClient
WHERE clientStatus='a' 
AND clientID NOT IN (SELECT clientID FROM tblCDSValidity)
ORDER BY clientName

Dear Prit,
It works great thank you very much.

Please mark this thread as solved.

Dear Prit,
I cannot find the option to mark it solved?

It's below, near the reply box. A text-link "mark as solved" if I remember correctly.

Dear Prit,
Ok done. Thank you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.