create table #t( ID1 int,ID2 varchar(2),stime varchar(8))
insert #t
select 1,'p2',''
union all select 2,'p2',''
union all select 3,'p1',''
union all select 4,'p3',''
union all select 5,'p1',''
select * from #t
select top 1 ID2 from (select ID2,icount = count(ID2) from #t group by ID2)A order by icount desc