title: How to group by DATE only in column datetime
body: <p>I'm having a problem with grouping in SQL Server Express 2005</p>
  
  <p>I have a <code>DATETIME COLUMN</code> but i want to group it only by date.</p>
  
  <p>Here my SQL Statement:</p>
  
  <pre><code>SELECT (u.FirstName + ' ' + u.LastName) AS [FullName],d.user_id,CONVERT(varchar,d.log_date,101) AS log_date, min(d.login_time) as LOG_IN, max(d.logout_time) as LOG_OUT, sum(d.totaltime) as TOTHrs 
  FROM tbldtr d INNER JOIN tblUsers u ON d.user_id = u.User_Id
  WHERE d.user_id = 'ADMIN1' and d.log_date BETWEEN '6/1/2013' AND '6/15/2013'
  GROUP BY DATEADD(day, DATEDIFF(day, 0, log_date), 0),u.FirstName,u.LastName,d.user_id order by d.log_date asc
  </code></pre>
  
  <p>but it give me this error:</p>
  
  <blockquote>
    <p><strong>Column 'tbldtr.log_date' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY
    clause.</strong></p>
  </blockquote>
  
  <p>Thanks in advance.!</p>