gpt4 book ai didi

MySQL:选择所有数据,但如果包含 ' * ' ,则显示最后四个字符

转载 作者:行者123 更新时间:2023-11-30 22:15:51 28 4
gpt4 key购买 nike

类似于:

SELECT IF( [call_history.callerid contains '*'], [如果包含,保留最后四个字符],[如果不包含,返回 ' '(not null)] ) AS 'test'

来自通话记录

ORDER BY 开始降序;

最佳答案

我建议阅读 MySQL 风格的 SQL 中内置的字符串函数的手册页:http://dev.mysql.com/doc/refman/5.7/en/string-functions.html

例如:

SELECT IF(LOCATE(callerid, '*'), SUBSTRING(callerid, -4), '') AS 'test'
FROM call_history
ORDER BY start DESC;

关于MySQL:选择所有数据,但如果包含 ' * ' ,则显示最后四个字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38316848/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com