title: How to optimize the sql query with aggregate function?
body: <p>Below is the sql query i want to optimize.</p>
  
  <pre><code> SELECT (ISNULL((SELECT SUM(Amount) FROM tblPayment WHERE TransactionType = 1 and AccountType = 2 and Status = 3),0) 
           +
           ISNULL((SELECT SUM(Amount) FROM tblPayment WHERE TransactionType = 2 and AccountType = 2 and Status = 3),0)
          ) 'Total Funds'
  </code></pre>
  
  <p>How can i optimize it in a better way ?</p>
  
  <p>Thanks for any suggestions!</p>