title: Group by in t-sql not displaying single result
body: <p>See the image below. I have a table, tbl_AccountTransaction in which I have 10 rows. The lower most table having columsn AccountTransactionId, AgreementId an so on.  Now what i want is to get a single row, that is sum of all amount of the agreement id. Say here I have agreement id =23 but when I ran my query its giving me two rows instead of single column, since there is nano or microsecond difference  in between the time of insertion.
  So i need a way that will give me row <strong>1550 | 23 | 2011-03-21</strong></p>
  
  <p><img src="https://i.stack.imgur.com/Fj7S4.png" alt="enter image description here"></p>
  
  <p><strong>Update</strong></p>
  
  <p>I have update my query to this</p>
  
  <pre><code>SELECT  Sum(Amount) as Amount,AgreementID, StatementDate
  FROM         tbl_AccountTranscation
  Where TranscationDate is null
  GROUP BY AgreementID,Convert(date,StatementDate,101)
  </code></pre>
  
  <p>but still getting the same error</p>
  
  <blockquote><pre>
  Msg 8120, Level 16, State 1, Line 1
  Column 'tbl_AccountTranscation.StatementDate' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
  </pre></blockquote>