i have a questing relating to sql, i have a table that has student
enrollment, and i need to find out how many students have enrolled in
the same number of subjects as that of student who's id is '0102',
note the subject could be different , but the final number ie. count.
has to be the same
the best i could come up with was ...
select student_id, count(*)
from student_enroll AS A
where student_id ='0102'
join (select student_id, count(*) from student where student_id <>
'0102' group by student_id) AS B on .........
now here i need to match the count , but don't know how... , can
somebody please helpSomething like this maybe
select student_id, count(*) as Tot_Subjects
from student_enroll AS A
group by student_Id
having
count(*) = (select count(*)
from student_enroll AS B
where student_id ='0102')|||thanks a lot omnibuzz,
that worked really fine, did'nt know it would be such simple.
thanks once again
No comments:
Post a Comment