1. 程式人生 > >mysql 模糊查詢 concat()

mysql 模糊查詢 concat()

gpo str2 mybatis select ati bat 字符串函數 where 一個

concat() 函數,是用來連接字符串。

精確查詢: select * from user where name=”zhangsan”
模糊查詢; select * from user where name like “%zhang%”

在實際的使用中,條件是作為參數傳遞進來的。 所以我們使用 concat() 函數

mybatis:
select * from user where name like concat(“%”, #{name},”%”)

concat(str1,str2,str3,str4,……….); 連接字符串函數,會生成一個字符串

mysql 模糊查詢 concat()