Решение SQL Server 2005
select * from
(
select *, c = COUNT(*) over (partition by userID)
from sampletable
) sq
where c > 1
или более обобщенно
select *
from sampletable
where userid in
(
select userid
from sampletable
group by userid
having COUNT(*) > 1
)
Используя этот образец
create table sampletable (serial_no int, userid int, enrollmentid int)
insert sampletable select 1234 ,100 ,44
insert sampletable select 1235 ,100 ,55
insert sampletable select 1236 ,200 ,33
insert sampletable select 1237 ,300 ,66
insert sampletable select 1238 ,400 ,88
insert sampletable select 1239 ,400 ,77
Вывод
serial_no userid enrollmentid
1234 100 44
1235 100 55
1238 400 88
1239 400 77