2015-08-14 64 views
1

我希望所有領域,從tblproduct在MySQL數據庫給定的字符串,可能使用語法表中找出所有領域:搜索在MySQL

SELECT * FROM tblproduct WHERE * LIKE '%textbox%'

是否有可能做這樣的事情?

+0

你的意思是搜索的所有列 –

+3

使用MATCH和其上全文搜索。而這個問題已經在這裏解答http://stackoverflow.com/questions/3797906/mysql-query-for-searching-through-all-the-fields –

+0

'SELECT * FROM

WHERE(CONVERT( USING utf8)LIKE' %textbox%'或CONVERT(使用utf8)LIKE'%textbox%'或......... –

回答

5

試試這個..

concate字段進行搜索全表

Select * from tblproduct where Concat(field1, '', field2, '', fieldn) like "%textbox%" 

在MySQL

SELECT * FROM tblproduct WHERE MATCH (field1, field2, field3) AGAINST ('textbox')