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: TurkBear <jvgreco_at_pop.primenet.com>
Date: 1997/10/31
Message-ID: <3459fbf5.348547614@news.primenet.com>#1/1

Thanks to Tim and all of you other folks for the quick assistance - Each of you had a slightly different approach and all appear feasable.

That's why I really like this group.

Thanks all again,
John Greco
Oracle DBA Now with improved 'memory upgrade' installed.

Tim McConechy <tmcconec_at_wie.com> wrote:

>Try something using temp tables,
>
>create table temp as select class_name,stud_nbr
> from class_attended where class_name in ('class1','class2'....)
>group bystud_nbr;
>
>select s.whatevercloumns
>from students s, classes_attended c
>where c.stud_nbr=s.stud_nbr --join on the key
>and s.class_name||to_char(s.stud_nbr) in (select
>class_name||to_char(stud_nbr) from temp);
>
>--Assuming class name is a varchar and stud_nbr is a number
>
>Not positive this will work but maybe you will get a few ideas!
>
>Good Luck
>
>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