Select the first log in Time using from Table using SQL Server 2008 R2 -


i have table of employees describe last , first name, card id , times log in enterprise. want select first time logs in.

thise example of table

thise example of table

and result want this result want

you group last name, first name , truncated date , return minimal date per group. in modern sql server versions truncation pretty simple - cast field_time date:

select   last_name,          first_name,          cast(field_time date) log_day,          min(field_time) first_log     mytable group last_name, first_name, cast(field_time date)  

Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -