Re: SQL Select

From: (wrong string) ørn Hansen <joh_at_stibo.dk>
Date: 1997/10/01
Message-ID: <34321E72.51F9251D_at_stibo.dk>#1/1


This is a multi-part message in MIME format.

--------------E403068FB3F1EF916B652A10
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<HTML>
<TT>SELECT&nbsp;&nbsp;&nbsp; s.STUDENT</TT>
<BR><TT>FROM&nbsp;&nbsp;&nbsp; STUDENT s</TT>
<BR><TT>WHERE s.STUDENTID IN (</TT>
<BR><TT>&nbsp;&nbsp;&nbsp; SELECT t.STUDENTID</TT>
<BR><TT>&nbsp;&nbsp;&nbsp; FROM&nbsp;&nbsp;&nbsp; TAKEN t</TT>
<BR><TT>&nbsp;&nbsp;&nbsp; GROUP BY t.STUDENTID</TT>
<BR><TT>&nbsp;&nbsp;&nbsp; HAVING COUNT(1) >= 2)</TT>
<BR>&nbsp;

<P>Mark McCubbin wrote:
<BLOCKQUOTE TYPE=CITE>I need help with an SQL query to determine which
students have taken two
<BR>or more courses. For example, what is the most efficient way to answer
<BR>the question: who has taken all three classes CS101, CS200,&nbsp; and
CS300?

<P>The tables are as follows (the relationship is one to many):

<P>STUDENT
<BR>StudentID
<BR>FirstName
<BR>LastName

<P>TAKEN
<BR>ClassTitle
<BR>StudentID</BLOCKQUOTE>

&nbsp;&nbsp;</HTML>

--------------E403068FB3F1EF916B652A10
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Jørn Hansen
Content-Disposition: attachment; filename="vcard.vcf"

begin:          vcard
fn:             Jørn Hansen
n:              Hansen;Jørn
org:            Stibo Datagrafik
email;internet: joh_at_stibo.dk
tel;work:       +45 8939 1189
tel;fax:        +45 8939 1112
tel;home:       +45 8624 0154

x-mozilla-cpt: ;0
x-mozilla-html: TRUE
end: vcard

--------------E403068FB3F1EF916B652A10-- Received on Wed Oct 01 1997 - 00:00:00 CEST

Original text of this message