tags:

views:

54

answers:

2

what is the error in the following mysql statement :

mysql> SELECT columnName  FROM tableName WHERE columnName LIKE  '%' + @variableName + '%';
+6  A: 

You can not concat strings using "+" symbol.

SELECT columnName 
FROM tableName 
WHERE columnName LIKE CONCAT('%',@variableName,'%');
ksogor
You beat me to it! +1
Amarghosh
A: 

or

SELECT columnName FROM tableName WHERE columnName LIKE '%@variableName%';

Carlos Martins