Home >Database >Mysql Tutorial >mysql存储过程变量的拼接_MySQL

mysql存储过程变量的拼接_MySQL

WBOY
WBOYOriginal
2016-06-01 13:42:291573browse

bitsCN.com mysql存储过程变量的拼接 有时候我们需要模糊查询,但是同时我们又要在模糊查询的时候使用变量,我们又想在变量的后面拼接一个%去匹配模糊查询 那么就会用到 concat函数 示例如下:      SELECT count(id) FROM config WHERE name like  concat(studentName,'%');  其中studentName是变量, 如果复制studentName的值=‘李’ 那么效果相当于 SELECT count(id) FROM config WHERE name like  ‘李%';    注意标点.  作者 god123209 bitsCN.com

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn