title: Column invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause
body: <p>We have a table which will capture the swipe record of each <code>employee</code>. I am trying to write a query to fetch the list of distinct employee record by the first swipe for today. </p>
  
  <p>We are saving the swipe date info in <code>datetime</code> column. Here is my query its throwing exception.</p>
  
  <pre><code> select distinct 
      [employee number], [Employee First Name]
      ,[Employee Last Name]
      ,min([DateTime])
      ,[Card Number]
      ,[Reader Name]
      ,[Status]
      ,[Location] 
  from 
      [Interface].[dbo].[VwEmpSwipeDetail] 
  group by  
      [employee number] 
  where 
      [datetime] = CURDATE();
  </code></pre>
  
  <p>Getting error:</p>
  
  <blockquote>
    <p>Column 'Interface.dbo.VwEmpSwipeDetail.Employee First Name' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.</p>
  </blockquote>
  
  <p>Any help please?</p>
  
  <p>Thanks in advance.</p>