MySQL - Is it possible to use LIKE on all columns in a table?

前端 未结 4 1709
暗喜
暗喜 2020-12-16 13:41

I\'m trying to make a simple search bar that searches through my database for certain words. It is possible to use the LIKE attribute without using WHERE? I want it to sear

4条回答
  •  别那么骄傲
    2020-12-16 13:47

    There IS a shortcut ! ;)

    SELECT * FROM shoutbox 
    WHERE CONCAT(name, foo, bar, baz) LIKE '%$search%' 
    

提交回复
热议问题