简体   繁体   English

如何在MySql SELECT语句中正确使用LIKE语句?

[英]How to use the LIKE statement correctly in a MySql SELECT statement?

Why isn't this working? 为什么这不起作用?

DELIMITER ;//

CREATE PROCEDURE `blah`
(
  SearchText varchar(4000)
)
BEGIN
  SELECT *
  FROM table_name
  WHERE table_name.StringField LIKE '%' + SearchText + '%'; -- This is where the code is breaking
END;//

尝试使用:

CONCAT('%', SearchText ,'%')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM