C
Chris2
Michel Walsh said:Hi,
Exactly. As example:
WHERE 60 <= ALL (SELECT note FROM courses WHERE studentID='Joe' )
would translate the fact that for a given student, all the courses have a
note >= 60. Someone could also express the same idea with:
WHERE 60 <= (SELECT MIN(note) FROM courses WHERE studentID='Joe' )
but that implies you mentally reversed the logic of the given rule, which
can lead to maintenance problem if the logic is complex.
Another example is about to know if all the tests had been made for a given
procedure: isTestDone is Boolean:
WHERE -1 = ALL (SELECT isTestDone FROM Tests WHERE procedureID= 4004 )
Without using the ALL quantifier... what would it be? Maybe:
WHERE NOT EXISTS( SELECT * FROM tests WHERE procedureID = 4004 AND NOT
isTestDone )
but the following won't work:
WHERE 0=(SELECT COUNT(*) FROM tests WHERE procedureID=4004 AND NOT
isTestDone )
since if there is no record, there is no row to hold the count(*). If you
want a solution based on 0 = COUNT(*), that becomes, like:
WHERE 0=(SELECT COUNT(*) FROM ( SELECT * FROM tests WHERE procedureID
= 4004 AND NOT isTestDone ) )
Hoping it may help,
Vanderghast, Access MVP
Michael Walsh,
Thanks.
I've got that copied away and will work on testing it all a little
later.
You wouldn't happen to have some DDL and sample data so I'm working
from the same point you were?
Sincerely,
Chris O.