On Tue, Aug 13, 2002 at 05:52:33PM +1000, Louis Selvon wrote:
> >You want to do
> BadWords LIKE '%a string test%'
>
> Just tried the above, but it cannot find that "test" exists as a bad word in
> the db BadWordsTable. The output I get is shown below
>
> ---------------------
> mysql> select BarWords from BarWordsTable where BarWords LIKE '%this is a
> test%';
>
> Empty set (0.00 sec)
"LIKE '%this is a test%'" should match any string that contains 'this is a
test' as a substring.
Do you have 'this is a test', or a string containing that, in BarWordsTable?
Judging from that result set, you don't.
Try, say, "LIKE '%a%'", which should match anything with an "a" in it. I
suspect what you want to do would be more like:
SELECT BarWords FROM BarWordsTable
WHERE BarWords LIKE '%this%' OR
BarWords LIKE '%is%' OR
BarWords LIKE '%a%' OR
BarWords LIKE '%test%';
Or perhaps you really mean:
SELECT BarWords FROM BarWordsTable
WHERE BarWords IN ('this', 'is', 'a', 'test');
(I think that works, but I'm not sure... it does work with MS SQL... I'm not
actually familiar with MySQL specifically.)
-Andrew.
--
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug