views:

199

answers:

1

I need to query the table for "all but keyword". Using just "-" doesn't work, and in fact mysql manual says:

Note: The - operator acts only to exclude rows that are otherwise matched by other search terms. Thus, a boolean-mode search that contains only terms preceded by - returns an empty result. It does not return “all rows except those containing any of the excluded terms.”

The only workaround I found was "a* b* .... y* z* -keyword", as this allows all other results to match. Is there any other (cleaner) way?

+1  A: 

Just use:

NOT MATCH(field) AGAINST(keyword)
Robert Gamble