PDA

View Full Version : Minus Function


James_Sheppard
12-04-2005, 11:41 AM
Hi

I have started to create a minus query, but I am unsure on how to start it.

I have the last part of the minus statement which goes like this.

MINUS

SELECT s.site_id, s.description
FROM holiday h, site s, holiday_site hs
WHERE s.site_id = hs.site_id
AND h.holiday_id = hs.holiday_id
AND h.difficulty_id IN ('A','B');

The query needs to return holidays which do not have an "Easy" or "Moderate" rating. The last part of the minus statement is correct, its just the first part I am unsure on.

I had thought that I would just use the same select statement above but add 'C' 'D' and 'E' to the last line, and then the minus fuction will remove 'A' and 'B'.

There are five tables - holiday, difficulty, site, holiday_site and holiday_date.

Just wondering if anyone has an idea what would the first part of the minus statement be like.

Many Thanks in advance for any ideas or suggestions.

GJay
12-04-2005, 04:22 PM
SELECT s.site_id, s.description
FROM holiday h, site s, holiday_site hs
WHERE s.site_id = hs.site_id
AND h.holiday_id = hs.holiday_id
AND h.difficulty_id NOT IN ('A','B');


Not sure why you need to use MINUS?

James_Sheppard
12-05-2005, 11:49 AM
We've been told to use the Minus function for this question.

Don't know if it has to be used but if that code you've just posted above works then I'll might as well use it.

Thanks:)