数据库查询telephone后四位为1111的人的id和姓名selectid,namewhere(selectsubstring(telephone,8,11)fromkehuxinxi_table)='1111')fromkehuxinxi_table;写完之后不能通过,问一下什么...
1 回答

交互式爱情
TA贡献1712条经验 获得超3个赞
不一定要用 SUBSTRING,直接用LIKE更简单
select id,name from kehuxinxi_table where telephone like '%1111'
如果一定要用SUBSTRING 那么,应该用下面类似的语句,不过,这种写法的速度是最慢的,而且还没有考虑长度不够的问题
select id,name from kehuxinxi_table where substring(telephone, 8, 4) = '1111'
- 1 回答
- 0 关注
- 614 浏览
添加回答
举报
0/150
提交
取消