Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL Select
select t2.studentiD from student t1,taken t2
where t1.studentID=t2.studentID
group by t2.studentID
having count(*) >= 2;
Output:
11111 2 55555 4
let me know if this helped.
Bye
Chinna
Mark McCubbin <mccubbin_at_mich.com> wrote in article
<34316AAE.3C99_at_mich.com>...
> I need help with an SQL query to determine which students have taken two
> or more courses. For example, what is the most efficient way to answer
> the question: who has taken all three classes CS101, CS200, and CS300?
>
> The tables are as follows (the relationship is one to many):
>
> STUDENT
> StudentID
> FirstName
> LastName
>
> TAKEN
> ClassTitle
> StudentID
>
Received on Mon Oct 06 1997 - 00:00:00 CDT