基本查询方式
SELECT
*
FROM
`test1`
WHERE
CONCAT(`name`, `age`) LIKE "%关键字%";
针对字段包含NULL
SELECT
*
FROM
`test1`
WHERE
CONCAT(IFNULL(`name`, ''), IFNULL(`age`, '')) LIKE "%模糊查询%";
SELECT
*
FROM
`test1`
WHERE
CONCAT(`name`, `age`) LIKE "%关键字%";
SELECT
*
FROM
`test1`
WHERE
CONCAT(IFNULL(`name`, ''), IFNULL(`age`, '')) LIKE "%模糊查询%";
评论区