有没有办法检测一个值是否是 MySQL 查询中的数字?比如
Is there a way to detect if a value is a number in a MySQL query? Such as
SELECT *
FROM myTable
WHERE isANumber(col1) = true
这应该适用于大多数情况.
This should work in most cases.
SELECT * FROM myTable WHERE concat('',col1 * 1) = col1
它不适用于非标准数字,例如
It doesn't work for non-standard numbers like
1e4
1.2e5
123.
(尾随十进制)1e4
1.2e5
123.
(trailing decimal)这篇关于检测MySQL中的值是否为数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!