title: How to lock the transaction untill single query completes its execution for not getting deadlock error
body: <p>I have the following code in which I have doubt.</p>
  
  <pre><code>Update Statement on Table 1
  
  Update Statement on Table 2
  
  Select Statement which include both the Table 1 
  </code></pre>
  
  <p>Now above code will return to the application. means it is get all function for the application.</p>
  
  <p>I am getting deadlock error in the application frequently.</p>
  
  <p><strong>I have hundred of users which is fetching the same table at a time.
  So I have to make sure that untill the completion of update statement select statement will not fire OR how to lock the update statement.</strong></p>
  
  <p>One more doubt that if suppose I am updating the one row &amp; another user has tried to select that table then will he get the deadlock.
  (User was trying to select another row which was not in the update statement.)
  what will happen for this scenario.</p>
  
  <p>Please help me.</p>
  
  <p>Thanks in advance  </p>