Re: how to write this query

From: commandantg <commandantg_at_sympatico.ca>
Date: Tue, 8 Oct 2002 21:14:55 -0400
Message-ID: <ZoLo9.23366$zU5.887043_at_news20.bellglobal.com>


how about

SELECT st_id
FROM student
WHERE st_id NOT IN(SELECT unique st_id FROM course WHERE subj_id IN(23, 24);

george

"Kumar" <kumar_kmk_at_hotmail.com> wrote in message news:bce41b15.0210081653.1c5490c1_at_posting.google.com...
> I have these tables
>
> student( st_id,name)
> subject (subj_id,name)
> course (st_id,subj_id) 1 student can takemutiple subjects.
>
> I want a query to find all students who did not take any of subj_id's say
 23,24
>
> So if
> student1 takes subjects 21,24,45
> student2 takes 1,12,23,67,75
> student3 takes 14,23,24,27
> student4 takes 1,2,3,4
>
> The query should return me studentid's 1 and 4 only
>
> Thanks
> Kumar
Received on Wed Oct 09 2002 - 03:14:55 CEST

Original text of this message