user3264863 user3264863 - 6 months ago 4x
SQL Question

Mysql full text search with match and against

I have to use mysql full text search on description field.

Now suppose i have following 4 records in a table :

Description field:
aa bb cc dd
xx aa ff gg
hh kk cc qq
cc ee tt aa

Now if i search term "aa cc", then it should read those description where these two words must be there in record. So following records should be result.

aa bb cc dd
cc ee tt aa

How to write mysql
match() against()
query ?


Assume your table name is table1 and column which contain string is col_name then you can use following query

select * from table1 where col_name like '%aa%' and col_name like '%cc%'