title: How can I get the min and max date per date of employees?
body: <p>This is my table looked like:</p>
  
  <pre><code>Employee_Number       |       DateTime
  00000001              |       2014/01/14  09:20
  00000001              |       2014/01/14  12:35
  00000001              |       2014/01/14  13:35
  00000002              |       2014/01/14  09:20
  00000001              |       2014/01/14  22:49
  00000001              |       2014/01/15  09:35
  00000001              |       2014/01/15  10:35
  00000001              |       2014/01/15  17:35
  00000002              |       2014/01/14  12:34
  00000002              |       2014/01/14  17:34
  </code></pre>
  
  <p>I want to do a select statement where I will get the min and the max datetime of employee per day something like this:</p>
  
  <pre><code>Employee_Number       |       DateTime             MIN                  MAX
  00000001              |       2014/01/14      2014/01/14  09:20    2014/01/14 22:49
  00000001              |       2014/01/15      2014/01/15  09:35    2014/01/15 17:35
  00000002              |       2014/01/14      2014/01/14  09:20    2014/01/14  17:34
  </code></pre>
  
  <p>I already searched google to find answer to my dilemma but the very near sql statement that I can have is this:</p>
  
  <pre><code>declare @tmp table (
  tranDate int,
  tranTime datetime
  
                     )
  
   insert into @tmp
   select Convert(int, convert(nvarchar(100), DateTime,112)) ,DateTime from tblExtract
  
   select tranDate, min(tranTime) as 'min' , max(tranTime) as 'max' from @tmp
   group by tranDate
  </code></pre>
  
  <p>The problem is it only shows the min and max of the day not per employee_number. How can I solve this?</p>