title: Getting sum of a column on a specific condition
body: <p>Here is my table's columns:</p>
  
  <ul>
  <li>Id (int)</li>
  <li>A (int)</li>
  <li>B (int)</li>
  </ul>
  
  <p>I want to calculate a sum by the following specific condition using T-SQL:</p>
  
  <ul>
  <li>if column B is not null add its value to sum</li>
  <li>if column B is null add value of column A to sum</li>
  </ul>
  
  <p>How can I calculate the sum without updating the original data in an efficient way?</p>
  
  <p>Thanks in advance,</p>