sql数据库,字段类型为‘varchar’,类似于26,10,56,100。如何判断里面是否有小于50的

2025-02-02 13:04:02
推荐回答(2个)
回答1:

select * from tablea where isnumeric(a)=1 and a<'50'

先用isnumeric(a)=1过滤出可以转换为数字的数据,然后再判断<'50'即可

回答2:

select *
from 表
where 字段 < '50' and len('字段') = 2