Re: Searching with AND - the Google way



Thank you Dan!

Good and straight forward solution.
Why didnt I think of it myself....
:-)

Best regards
Rune


"Daniel Crichton" <msnews@xxxxxxxxxxxxxxxx> wrote in message news:u%23$QTAPfHHA.596@xxxxxxxxxxxxxxxxxxxxxxx
Rune wrote on Thu, 12 Apr 2007 11:30:05 +0200:

I would like to be able to search my table for records containing several words.
Like a standard Google-search where AND is implied when you enter more
than one word.

Example:
My PRODUCTS table has a free-text index on the columns [Title] and [Description]
Row1: Title: "MS Word", Description: "Word processor from Microsoft"
Row2: Title: "MS Excel", Description: "Spread*** from Microsoft"

How to search for records containing the words "Microsoft" and "Excel"?
I would like to have Row2 returned.

SELECT * FROM Products WHERE CONTAINS((*),'"Microsoft" AND "Excel"')
- returns no rows because no column contains both words.

Suggestions anyone?

As you've found the words have to be in the same column for this to work. What you could do is this:

SELECT * FROM Products WHERE CONTAINS(*,'Microsoft') AND CONTAINS(*,'Excel')

which is how I handle multiple words on my own sites.

Dan


.