sql question [possibly OT]

by "Raj Bhaskar" <raj(at)lordofthemoon.com>

 Date:  Thu, 08 Aug 2002 12:21:25 +0100
 To:  hwg-languages(at)hwg.org
  todo: View Thread, Original
Hi folks,
I'm not sure whether or not SQL is covered by this list's remit but I'll try anyway.

I have two tables in an SQL Server 2000 database: 
course(courseID, title)
universitydoescourse(uniID, courseID)

I want to write a query that will return the course IDs of those courses that a university is *not* 
allowed to do.  Basically, I think that I want *what's left over* when this query is executed:

select c.courseID, c.title
from course c, universitydoescourse u
where u.uniid=<uniid here> and u.courseid=c.courseid

This returns the courseIDs of the courses that the university *is* allowed to do, but I'm not sure 
how to get its inverse.  I could probably work around it in code, but I'd rather do it in a query if at all 
possible.

TIA,
Raj.
-- 
Rajnish Bhaskar
r.bhaskar(at)compserv.gla.ac.uk, http://lordofthemoon.com
IT Education Unit, University of Glasgow
http://www.iteu.gla.ac.uk/
--
Happiness, Happiness,
The greatest gift that I possess,
I thank the Lord that I've been blessed,
With more than my share of happiness.

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA

This page is part of a preserved archive of archives.hwg.org. The site is no longer active and its content is not maintained. For enquiries about this archive, write to archive(at)iwanet.org.