mybaits like查询


各个数据库like写法:

oracle数据库:

SELECT
*
FROM
user
WHERE
name like CONCAT('%',#{name},'%')
或 :

SELECT
*
FROM
user
WHERE
name like '%'||#{name}||'%'
 

SQLServer数据库:

SELECT
*
FROM
user
WHERE
name like '%'+#{name}+'%'
 

mysql数据库: 

SELECT
*
FROM
user
WHERE
name like CONCAT('%',#{name},'%')
 

DB2数据库:

SELECT
*
FROM
user
WHERE
name like CONCAT('%',#{name},'%')

或 

SELECT
*
FROM
user
WHERE
name like '%'||#{name}||'%'
 

建议使用mybatis标签:


0
0

暂无评论