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 Query Help please

Re: Sql Query Help please

From: Michael Serbanescu <mserban_at_postoffice.worldnet.att.net>
Date: 1997/10/31
Message-ID: <63c2ui$bmv@bgtnsc02.worldnet.att.net>#1/1

Try this:

SELECT student_id
FROM classes_attended
WHERE class_name='class1'
INTERSECT
SELECT student_id
FROM classes_attended
WHERE class_name='class2'
INTERSECT
SELECT student_id
FROM classes_attended
WHERE class_name='class3',
etc.

Hope this helps.

Michael Serbanescu



On 30 Oct 1997 12:06:01 -0700, jvgreco_at_pop.primenet.com (TurkBear) wrote:

>I have 2 tables, students and classes_attended in a 1 to many
>relationship.
>
>I need a query that will select students that have attended a specific
>set of classes and only if they have attended ALL the classes
>specified ( that's why a OR where clause dosen't work) - any ideas?
>
>stud_nbr is the key field in both tables.
>
>Thanks,
>John Greco
>Oracle DBA suffering from 'out-of-memory' error in brain.
>
Received on Fri Oct 31 1997 - 00:00:00 CST

Original text of this message

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