Thanks.  You all are awesome.  With SQL Server, it wants a join
statement in the sub select, as in your second example.  Here is my
final select statement.

select Student_ID, S_first_final, S_last, Adviser_full  from
tblStudents2003 a1 where Current_grade > 8 and Student_ID not in (SELECT
StudentID FROM DDgroupSignups e2 WHERE e2.studentID =
a1.student_ID)order by adviser_full, s_last

Cheers,

John Newsom

-----Original Message-----
From: Bill Downall [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 10, 2004 10:47 AM
To: [EMAIL PROTECTED]
Subject: Re: Witango-Talk: simple? SQL question


SELECT <whatever> FROM AllStudents WHERE studentID NOT IN 
(SELECT StudentID FROM enrolledStudents)

Or, for better performance with some databases:

SELECT <whatever> FROM AllStudents a1 WHERE studentID NOT IN 
(SELECT StudentID FROM enrolledStudents e2 WHERE e2.studentID = 
a1.studentID)

Bill


On Tue, 10 Feb 2004 10:29:11 -0800, John Newsom wrote:

>I have a taf that students use to sign up for events.  I want to be 
>able to easily report to the event planners which students have NOT 
>signed up.  I have another taf that creates two arrays, one of all 
>students, and one of enrolled students, and then iterates through and 
>creates a new array that contains the non-enrolled students.  But I 
>figure there must be an elegant sql statement (outer join maybe) that 
>can compare the two tables (all students and enrolled students) and 
>kick out the non matches.

>Thanks,

>John Newsom
>Lakeside School

>_________________________________________________________
_______________
>TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf





________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf

________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf

Reply via email to