Link to home
Start Free TrialLog in
Avatar of johnnyg123
johnnyg123Flag for United States of America

asked on

Case with exists with innerjoin in update query

Here is some sample data from 2 tables I have

Table 1  
MailCustomer

CustomerID
12345
56768


Table 2
CustomerOrder

CustomerID     MailFlag
12345
66666

I am trying to write an update query that will :

update the Customer flag to 'T' on Customer Order table If the Customer Number exists in the Mail Customer table.  

update the Customer flag to 'F' on Customer Order table If the Customer Number does not exist in the Mail Customer table.  

Given data above table below should look like below after query

CustomerOrder

CustomerID     MailFlag
12345                T
66666                F


Was thinking of using case with inner join but not sure how
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
and of course make sure you have a index on customerorder.customerid to get the update done fast
Avatar of johnnyg123

ASKER

Great! Thanks!