title: How write two update queries using join condition in sql server
body: <p>I have two tables <code>1-&gt;CompanyMaster_tbl</code> in this having Two fields . <code>Cid and CompanyName</code>,</p>
  
  <blockquote>
    <p>Cid is the primary key of this table</p>
  </blockquote>
  
  <p>2-><code>DepartmentMaster_tbl</code> in this having 4 fields. <code>dtid,dtname,dtphon,dtmail,Cid</code>.  </p>
  
  <blockquote>
    <p>dtid is the primary key,and Cid is the foreign key</p>
  </blockquote>
  
  <p>I have two update query like this:</p>
  
  <pre><code>UPDATE CompanyMaster_tbl SET CompanyName = @CompanyName WHERE Cid = @Cid
  
  update DepartmentMaster_tbl set dtName = @dtName,dtPhone = @dtPhone,dtEmail = @dtEmail  where dtId=@dtid
  </code></pre>
  
  <p>is there any way to write this two query in single line with any of our join condition</p>