can I use contains function in mysql 4.0.27?
i run this sql in mysql 4.0.27:
select * from table where contains(name,"foo");
report a syntax error, why?
can开发者_如何转开发 I using contains function in mysql 4.0.27?
thanks for help :)
I doesn't look like CONTAINS()
is a MySQL function, but you can use the INSTR()
function in MySQL 4.0 as follows:
SELECT * FROM table WHERE INSTR(name, 'foo') > 0;
You can also use the LIKE
operator:
SELECT * FROM table WHERE name LIKE '%foo%';
However keep in mind that such queries would not use an index on the name
field if one exists.
精彩评论