|
Posted by Hugo Kornelis on 08/28/05 22:10
On 27 Aug 2005 08:50:45 -0700, coosa wrote:
>Your logic is quite interesting and i'd like to learn much from you.
>First, select '%'+@search_key1+'%' or select '%'+@search_key2+'%' etc.
>would bring some results, then why do you write "where NOT exists"?
Hi Coosa,
Remember back at school, when your English teacher told you: "Don't use
no double negations, not never"?
He was wrong.
I didn't take the time to go over all details in Steve's post, but at
first glance it lloks just like the "relational division" I mentioned in
my previous post.
You wanted to find items that satisfy all search terms. Steve put the
search terms in a derived table, then went on to use the standard
solution for finding a match that satisfies all rows - by rephrasing it
with a double negation:
"Find items that match all search terms" --> "Find items for which there
is no search term that it doesn't match".
Hence the use of not one but actually _TWO_ not exists conditions.
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)
[Back to original message]
|