exo繁星文txt百度云:sql select 中 怎么把 字段值 的某几位作为条件?

来源:百度文库 编辑:高校问答 时间:2024/04/28 19:41:01
如有一字段名字tk1,值为aaaabbccdd,我想查询tk1字段的5.6位值为bb的记录?

select * from table1 where tk1=???

该怎么写语句?
nnigou 所说用mid函数是不行的.select 不支持mid 函数.

flashmayi 所说用%bb% 不能准确定位.

试试这个:
where substring(tk1,5,2)='bb'

用mid函数
select * from table1 where mid(tk1,5,2)='bb'