select
id,
IFNULL(nickname,
concat(
substring(mobile, 1, 3),
'****',
substring(mobile, 8)
)
) userName
from user
上述代码 nickname 如果为空,则返回 mobile 的值,并且用 * 号加密 mobile
欢迎访问个人主页: https://tangyuewei.com/
select
id,
IFNULL(nickname,
concat(
substring(mobile, 1, 3),
'****',
substring(mobile, 8)
)
) userName
from user
上述代码 nickname 如果为空,则返回 mobile 的值,并且用 * 号加密 mobile
欢迎访问个人主页: https://tangyuewei.com/