Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL Select

Re: SQL Select

From: Chinna <jchinna_at_enron.com>
Date: 1997/10/06
Message-ID: <01bcd299$972bf180$06f7fb9b@eoghou1325.eog.enron.com>#1/1

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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US