Thursday, February 16, 2012

Rozenshtein question 4(sql cookbook)

all students taking less than 3 courses - easier solution than book

select distinct * from
(
select s.* , count(*) over(partition by s.sno)  cnt
from student s  inner join take t
on t.sno = s.sno
) main
where main.cnt <= 2

No comments:

Post a Comment