aarona
aarona

Reputation: 37303

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;//

Upvotes: 0

Views: 466

Answers (1)

Ryan Oberoi
Ryan Oberoi

Reputation: 14505

Try using:

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

Upvotes: 4

Related Questions