Re: SQL query may not be enough, what else should I try?

From: DanHW <danhw_at_aol.com>
Date: 23 Mar 2000 06:38:29 GMT
Message-ID: <20000323013829.13560.00001462_at_ng-bj1.aol.com>


>Environment: Windows NT Reports 2.5 Oracle 10.7 NCA, 7.3
>
>I'm creating a report. I've got three tables to extract data from
>(simplified this for clarity).
>
>Table A holds all the student names, Table B has holds the associations
>between Table A and Table C. Table C contains all classes offered.
>
>I want to learn which students (undergrads) are not currently enrolled in a
>particular group of classes (e.g. Humanities), and have not accrued at least
>18 total units - over the entire time so far spent here. The second part
>I've got, but the first part of that has me stifled for a good solution.
>
>How would I do that? It's kind of like proving a negative. I would guess I
>could perform several queries, maybe create a view or two, but it gets more
>complicated because while I have used SQL for querying against conditions
>met, I have not for conditions that haven't been met.
>
>Does this make sense? Have I stated it clearly? I seem to be blocked for a
>solution at the moment, but putting something in simple terms helps. I
>wasn't coming to you for the answer, just as a sounding board.
>
>Thanks for reverberating
>

In addition to the sub-query suggested, you can also do a SELECT-MINUS query...

Select ID from (all students) minus
Select ID from (those in a humanities class)

will give those NOT in a humanities class

Hope that helps a little...

Dan Hekimian-WIlliams Received on Thu Mar 23 2000 - 07:38:29 CET

Original text of this message