mysql 模糊查詢 concat()


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,……….); 連接字符串函數,會生成一個字符串 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM