title: sql query to find sum of all rows and count of duplicates
body: <p>If data is in the following format:</p>
  
  <pre><code>SID  TID  Tdatetime        QID   QTotal  
  ----------------------------------------
  100  1    01/12/97 9:00AM  66    110   
  100  1    01/12/97 9:00AM  66    110  
  100  1    01/12/97 10:00AM 67    110  
  100  2    01/19/97 9:00AM  66    .  
  100  2    01/19/97 9:00AM  66    110  
  100  2    01/19/97 10:00AM 66    110  
  100  3    01/26/97 9:00AM  68    120  
  100  3    01/26/97 9:00AM  68    120  
  110  1    02/03/97 10:00AM 68    110  
  110  3    02/12/97 9:00AM  64    115  
  110  3    02/12/97 9:00AM  64    115  
  120  1    04/05/97 9:00AM  66    105  
  120  1    04/05/97 10:00AM 66    105  
  </code></pre>
  
  <p>I would like to be able to write a query to sum the QTotal column for all rows and find the count of duplicate rows for the Tdatetime column. </p>
  
  <p>The output would look like:<br>
   <pre><code>  Year   Total  Count<br>
       97 | 1340 | 4
  </code></pre>
  The third column in the result does not include the count of distinct rows in the table. And the output is grouped by the year in the TDateTime column.</p>