update version of SQL update question (sorry for confusion)

This is an updated version of questions posted by me before
(SQL update/set more than one column 7/30/07 and SQL update logic 7/28/07).
I hope this version is clear.
I have four tables:
Table1, Table2, Table3, and Table4
Table1 and Table2 have common column id. Table2 has columns that can be matched with columns in Table3 and Table4.
I need to join Table1 and Table2 and update column in Table1 depending on different conditions
(1)      when Table2.colA = Table3.ColA and Table2.colB = Table3.ColB Then 1 (set to 1 if a match and dont check anything else)
(2)      when Table2.colA=Table4.ColA and Table2.colB = Table4.ColB  Then 2 (set to 2 if a match and dont check anything else)
else  3

If there is no match for when (1) and when (2) then set the value to 3.
Who is Participating?
wsh2Connect With a Mentor Commented:
For MsAccess Jet:
    (( [Table1] T1
       [Table2] T2
    ON T1.[Key] = T2.[Key]
       [Table3] T3
    ON T2.[ColA] = T3.[ColA]
   AND T2.[ColB] = T3.[ColB]
       [Table4] T4
    ON T2.[ColA] = T4.[ColA]
   AND T2.[ColB] = T4.[ColB]
   SET T1.[MyField] = IIF(ISNULL(T3.[ColA], 2, 1)
     ( ISNULL(T3.[ColA]) <> True  
   AND ISNULL(T3.[ColB]) <> True  
     ) OR
     ( ISNULL(T4.[ColA]) <> True  
   AND ISNULL(T4.[ColB]) <> True  

Respectfully, why the B grade?..

What part of your question did I not respond to? and if I did, what additional comment of yours did I miss? Quite frankly, what more could I have done with the information you provided?
jgordin.. please take a moment and read the grading guidelines:


What's the right grade to give?

Although we use an A-C scale here at Experts Exchange, it works differently than, say, school grades. If one or more Experts' proposals are accepted as answers, they should usually be given an A or B grade, since they have taken the time to provide you with a working solution. If a possible solution is incomplete, ask for clarification or details before accepting the answer and grading it. People should not be given lower grades because of incorrect grammar or because you just accepted their answer or comment to close the question. The following is a good guideline to follow when grading:

A: The Expert(s) either provided you with a thorough answer or they provided you with a link to information that thoroughly answered your question. An "A" can also be given to any answer that you found informative or enlightening beyond the direct question that you asked.

B: The Expert(s) provided an acceptable solution, or a link to an acceptable solution, that you were able to use, although you may have needed a bit more information to complete the task.

C: Because Experts' reliability are often judged by their grading records, many Experts would like the opportunity to clarify if you have questions about their solutions. If you have given the Expert(s) ample time to respond to your clarification posts and you have responded to each of their posts providing requested information; or if the answers, after clarification, lack finality or do not completely address the issue presented, then a "C" grade is an option. You also have the option here of just asking Community Support to delete the question.

Remember, the Expert helping you today is probably going to be helping you next time you post a question. Give them a fair chance to earn an 'Excellent!' grade and they'll provide you with some amazing support. It's also true that a "C" is the lowest grade you can give, and the Experts know that -- so use it judiciously.

The use of a C in a vindictive manner is likely to be changed by a Moderator. You may not like the answer you get, and in some cases, and you may not like the way it is delivered, but if it is deemed to be accurate, no less than a B is an acceptable grade.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.