title: Sum Rows of Data
body: <p>I'm trying to get Rows of data to Sum when a check number is the same.</p>
  
  <pre><code>select
   chkdetail_t.check_acct,
   chkheader_t.acct_number,
   chkdetail_t.check_number,
    SUM(CASE WHEN chkdetail_t.check_number = chkdetail_t.check_number THEN  chkdetail_t.amount ELSE NULL END)  AS chek_total,
   convert(VARCHAR(10),CAST(chkdetail_t.check_date as datetime), 101) AS chk_date,
   chkdetail_t.amount,
   chkdetail_t.vend_name,
   chkdetail_t.chk_status,
   chkdetail_t.reconsiled,
   chkdetail_t.chk_type
  
  
   from dbo.chkdetail_t
   join dbo.chkheader_t
   on chkheader_t.check_acct = chkdetail_t.check_acct
  
  
   where chkdetail_t.check_acct = 'HUNTINGTON'
   and chkdetail_t.chk_status not in ('V', 'R')
   and chkdetail_t.chk_type != 'R'
   and chkdetail_t.reconsiled = 0
  
   group by chkdetail_t.check_acct,
  chkheader_t.acct_number, 
  chkdetail_t.check_number, 
  chkdetail_t.check_date,
  chkdetail_t.amount,
  chkdetail_t.vend_name,
  chkdetail_t.chk_status,
  chkdetail_t.reconsiled,
  chkdetail_t.chk_type
  
  check_number    chek_total
  065757          50.00
  065757          522.20
  065757          581.70
  065757          4492.88
  065757          4832.92
  </code></pre>
  
  <p>I need to scan the check_number rows from top to bottom and find the ones that equal each other so I can calculate the sum of each check number.</p>