i have a table name as testtabl1
now
i want to find all the student who are enroll in 2 or more courses,
in this sid
is the student id and cid
is the course id
table structure
create table testtabl1(Sid int,cid int,years varchar(20))
insert into testtabl1(Sid,cid,years)
select 1,1,'2016'
union all
select 2,2,'2017'
union all
select 1,2,'2017'
new to sql server and stackoverflow need help !!
tried
select sid,COUNT(*),cid from testtabl1 group by sid,cid having count(*)>1