Примерно так может работать в зависимости от используемых типов данных.
declare @T table
(
id varchar(2),
[Date] datetime,
[Time] varchar(5),
[Status] varchar(5)
)
insert into @T
select '01', '1/02/12', '8:10', 'Entry' union all
select '01', '1/02/12', '9:00', 'Exit' union all
select '01', '1/02/12', '9:10', 'entry' union all
select '01', '1/02/12', '17:00', 'Exit' union all
select '02', '1/02/12', '8:10', 'Entry' union all
select '02', '1/02/12', '9:00', 'Exit' union all
select '02', '1/02/12', '9:10', 'entry' union all
select '02', '1/02/12', '17:00', 'Exit'
select id,
convert(varchar(8), [Date], 1) as [Date],
convert(varchar(5), min([Time]), 108) as [Entry],
convert(varchar(5), max([Time]), 108) as [Exit]
from
(
select id,
[Date],
cast([Time] as datetime) as [Time],
row_number() over(partition by id order by [Date]+cast([Time] as datetime) asc) as rn1,
row_number() over(partition by id order by [Date]+cast([Time] as datetime) desc) as rn2
from @T
) as T
where T.rn1 = 1 or
T.rn2 = 1
group by id, [Date]
Результат:
id Date Entry Exit
---- -------- ----- -----
01 01/02/12 08:10 17:00
02 01/02/12 08:10 17:00