title: SQL Server query for SUM based on column value
body: <p>I have table like below:</p>
  
  <pre><code>fld_bank_cash_particular_id  fld_cr_dr  fld_account_id  fld_amount
  1                            Dr         26              1000
  2                            Dr         26              2000
  3                            Dr         26              3000
  4                            Cr         26              4000
  5                            Dr         26              5000
  6                            Cr         26              6000
  7                            Dr         26              7000
  8                            Dr         26              8000
  9                            Dr         26              9000
  10                           Cr         26              10000
  11                           Dr         27              1000
  12                           Dr         27              2000
  13                           Dr         27              3000
  14                           Cr         27              4000
  15                           Dr         27              5000
  16                           Cr         27              6000
  17                           Dr         27              7000
  18                           Dr         27              8000
  19                           Dr         27              9000
  20                           Cr         27              1000
  </code></pre>
  
  <p>I want SUM() of all amount with column value 'Dr' as Payments and SUM() of all amount with column value 'Cr' as Receipts[Result should display AccountId wise Payments and Receipts]. Same Output like below:</p>
  
  <pre><code>AccountId   Payments    Receipts
  26          35000       20000
  27          35000       20000
  </code></pre>
  
  <p>Currently i'm getting below result:</p>
  
  <pre><code>AccountId   Payments    Receipts
  26          0           20000
  26          35000       0
  27          0           20000
  27          35000       0
  </code></pre>