MySQL Parameterized Query using Like

后端 未结 1 1883
悲哀的现实
悲哀的现实 2021-02-18 15:33

I want to run a query like this in MySQL:

select * from table where column1 like \'%searchdata%\'

But I want to use a parameter to pass in the

相关标签:
1条回答
  • 2021-02-18 16:33

    The % symbols need to be inside the parameter value, so it's something more like:

    select * from table where column1 like ?;
    

    And then you set the parameter to:

    %searchText%
    
    0 讨论(0)
提交回复
热议问题