title: Query not returning all results
body: <p>I have 881 rows that the query below should return, but only returns 744:     </p>
  
  <pre><code>SELECT MIN(DateTime),AVG(ISNULL((Convert(decimal(10,3),SCR1_EXHAUST_GAS_TEMP)),0))
  FROM jmusa_LOG1
  GROUP BY DATEPART(HH,DateTime),DATEPART(DD,DateTime)
  ORDER BY MIN(DateTime)
  </code></pre>
  
  <p>Now if I run these two queries separately I get 588 and 293,respectively,which equals the 881 I need:</p>
  
  <pre><code>SELECT MIN(DateTime),AVG(ISNULL((Convert(decimal(10,3),SCR1_EXHAUST_GAS_TEMP)),0))
  FROM jmusa_LOG1
  WHERE SCR1_EXHAUST_GAS_TEMP IS NULL
  GROUP BY DATEPART(HH,DateTime),DATEPART(DD,DateTime)
  ORDER BY MIN(DateTime)
  </code></pre>
  
  <p>The key difference in the above statement is the WHERE statement.</p>
  
  <pre><code>SELECT MIN(DateTime),AVG(ISNULL((Convert(decimal(10,3),SCR1_EXHAUST_GAS_TEMP)),0))
  FROM jmusa_LOG1
  WHERE SCR1_EXHAUST_GAS_TEMP IS NOT NULL
  GROUP BY DATEPART(HH,DateTime),DATEPART(DD,DateTime)
  ORDER BY MIN(DateTime)
  </code></pre>
  
  <p>The same key difference pertains here also, expect the please note the difference in that one has IS NULL, and the other IS <strong>NOT</strong> NULL</p>
  
  <p><strong>Now does anyone now why this is happening? And what my possible mistakes are that are causing the query first mentioned to not return all 881 results?</strong> </p>
  
  <p>DB Manager: SQL Server 2008 R2, and SSMS
  Date Format(if necessary): YYYY-MM-DD HH:MM:SS.000 </p>