Mysql query search a string in all columns of a table

后端 未结 4 1409
一向
一向 2021-01-27 11:43

I wonder how I can mount a SQL as portable as possible to query for all columns of a table for a specific phrase, like:

Table

ID | Name          


        
4条回答
  •  遇见更好的自我
    2021-01-27 12:20

    try this

       Select * FROM table WHERE text LIKE "%text%"
                              OR date LIKE "%2010%"
                              OR Name LIKE "%augusto%"
    

    if you want them all together then use AND

       Select * FROM table WHERE text LIKE "%text%"
                              AND date LIKE "%2010%"
                              AND Name LIKE "%augusto%"
    

提交回复
热议问题