join and value not found

User avatar
sal21
PlatinumLounger
Posts: 4370
Joined: 26 Apr 2010, 17:36

join and value not found

Post by sal21 »

Code: Select all

UPDATE ANA INNER JOIN PRE20 ON ANA.CAB = PRE20.CAB SET PRE20.SP = ANA.AG
WHERE (((PRE20.SP) Is Null));
Based this join is possible to update the field PRE20.SP with "9999" if the queryu no match?
Tks.

User avatar
HansV
Administrator
Posts: 78627
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: join and value not found

Post by HansV »

I'm not sure I understand your question, but perhaps

UPDATE PRE20 SET SP = '9999' WHERE SP Is Null AND CAB Not In (SELECT CAB FROM ANA)
Best wishes,
Hans