Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在解析一个文件并将其名称/值对存储在 mysql 数据库中。零值有多种数字:0、00、0000。是否有一个查询可以选择所有这些数字,而不连接“或”语句?
SELECT * FROM APP WHERE VALUE = '0' OR VALUE = '00' OR VALUE = '000';
虽然有很多选择VARCHAR0,00 的可能性,...(例如RLIKE和朋友)我建议您在导入时付出一些额外的努力,并将其转换为INT导入时
VARCHAR
RLIKE
INT
一些选择器:
colname RLIKE '0+';
CAST(colname AS UNSIGNED)=0
使用正则表达式:
SELECT * FROM APP WHERE VALUE REGEXP '0+';