Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/61.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
MySQL:选择所有数据,但如果包含“*”,则显示最后四个字符_Mysql_Sql_If Statement_Subquery_Oracle Sqldeveloper - Fatal编程技术网

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

MySQL:选择所有数据,但如果包含“*”,则显示最后四个字符,mysql,sql,if-statement,subquery,oracle-sqldeveloper,Mysql,Sql,If Statement,Subquery,Oracle Sqldeveloper,比如: 如果[call_history.callerid包含'*',[如果包含,保留最后四个字符],[如果不包含,则返回''notnull]作为'test' 从呼叫历史 按开始说明订购 我建议阅读MySQL风格的SQL中内置的字符串函数手册: 例如: SELECT IF(LOCATE(callerid, '*'), SUBSTRING(callerid, -4), '') AS 'test' FROM call_history ORDER BY start DESC; 我建议阅读MySQL风格

比如:

如果[call_history.callerid包含'*',[如果包含,保留最后四个字符],[如果不包含,则返回''notnull]作为'test'

从呼叫历史


按开始说明订购

我建议阅读MySQL风格的SQL中内置的字符串函数手册:

例如:

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

我建议阅读MySQL风格的SQL中内置的字符串函数的手册页面:

例如:

SELECT IF(LOCATE(callerid, '*'), SUBSTRING(callerid, -4), '') AS 'test'
FROM call_history
ORDER BY start DESC;
David使用case/当David使用case/当