msql以某个字符串开头条件查询,除了like替代方式 + 模糊查询小总结

    xiaoxiao2022-07-12  140

    https://blog.csdn.net/zhanxiaochu/article/details/81381627

    1:以字段开头模糊查询的like的方法查询

    select * from t  where  t.user_code like 'A%'

    2:以字段开头模糊查询的left(字段,长度)的方法查询

    select * from t  where left(t.user_code, 1)='A';

    3:字符间隔查询段对应的值以 1,4,6 的格式查询使用find_in_set

    select * from t  where FIND_IN_SET('1',t.name);//t.name所查询的字段,所有包含1的数据  

    MySql like模糊查询使用详解      like  &&  regexp

    mysql中REGEXP正则表达式使用

    最新回复(0)