Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/64.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/77.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 sql结果仅包含数值_Mysql_Sql - Fatal编程技术网

Mysql sql结果仅包含数值

Mysql sql结果仅包含数值,mysql,sql,Mysql,Sql,我正在尝试创建一个sql查询,它只返回数值结果 我试过这个,但对我不起作用: select * from crm.Communication cm where cm.TypeKey = 4 and data like '%[^0-9]%' 当有一个字母数字值时,我不想要结果 希望你们能帮助我 Bg, 法国你能试试这个吗 select * from crm.Communication cm where cm.TypeKey = 4 and ceil(data) = data 如果您想使用RE

我正在尝试创建一个sql查询,它只返回数值结果

我试过这个,但对我不起作用:

select *
from crm.Communication cm
where cm.TypeKey = 4 and data like '%[^0-9]%'
当有一个字母数字值时,我不想要结果

希望你们能帮助我

Bg, 法国你能试试这个吗

select *
from crm.Communication cm
where cm.TypeKey = 4 and  ceil(data) = data
如果您想使用REGEXP

您需要像这样删除like并放置REGEXP

select *
from crm.Communication cm
where cm.TypeKey = 4 and data REGEXP '[^0-9]'
也不用

select *
from crm.Communication cm
where cm.TypeKey = 4 and data not like '%[^0-9]%'

您使用的是正确的正则表达式,但不是正则表达式,而是like。使用
REGEXP
而不是像这样使用

select *
from crm.Communication cm
where cm.TypeKey = 4 and data REGEXP '%[^0-9]%'

请提供表架构。请参阅“它对我不起作用”不是问题描述。为什么不起作用?它抛出了一个错误吗?如果是,错误是什么?它没有返回预期的结果吗?它返回了什么?您期望得到什么?您希望“不象a-z”。这不是正则表达式语法吗?使用不象“[^0-9]”您能描述一下这里发生了什么吗?(我不知道MySQL。)@jarlh发生的事情是,你不能在任意的SQL函数中转储正则表达式,这只可能在那些实际需要它们的函数中实现。@krishnpatel
%
在正则表达式中的意思正是,
%