⌘BABAKOV.NET Let's code!
100% [light] [ru]

Updating a table with a condition based on the second table through JOIN MSSQL

Example of updating data in one table with simultaneous comparison and condition check based on the second table using JOIN:

update cc
 set cc.ActivateState=2
  from ClientsCards cc
   left join ClientsCardsHeads cch 
    on cch.CardUid=cc.Uid
where cc.ActivateState=0 and cch.State=3


ClientsCards cc
- The first table where the change is made.

ClientsCardsHeads cch - The second table with data that is being compared.

Comments (0)

No comments yet.

Leave a comment
Comment
Images (up to 5 MB)
Your comment will appear after moderation.