select * from tm where DATEPART(hh, [savedate])>=9 and empid not in (select empid from tm where DATEPART(hh, [savedate])<9)
Updated solution:
;With Cte
as
(select t1.* from tm t1
inner join tm t2 on t1.empid=t2.empid and convert(char(10), t1.[savedate], 111)=convert(char(10), t2.[savedate], 111)
where DATEPART(hh, t1.[savedate])>=9 and DATEPART(hh, t2.[savedate])<9)
select * from tm where tm.empid not in (select empid from Cte where convert(char(10), tm.[savedate], 111)=convert(char(10), cte.[savedate], 111))
output:
uid empid savedate
1 9003 2012-09-26 09:20:00.000
3 9000 2012-09-26 09:20:00.000
my table and insert query
create table tm
(uid int,
empid int,
savedate datetime)
insert into tm values (1, 9003, '2012-09-26 09:20:00')
insert into tm values (3, 9000, '2012-09-26 09:20:00')
insert into tm values (4, 9004, '2012-09-26 09:20:00')
insert into tm values (5, 9002, '2012-09-26 09:20:00')
insert into tm values (7, 9001, '2012-09-26 09:20:00')
insert into tm values (11, 9004, '2012-09-26 08:59:00')
insert into tm values (12, 9002, '2012-09-26 08:59:00')
insert into tm values (14, 9001, '2012-09-26 08:59:00')
)