项目数据库为SQL Server 要求实现电话号筛选:
第一中类型: ABAB
select * from telephone where SUBSTRING(telenumber,8,2)=SUBSTRING(telenumber,10,2) and SUBSTRING(telenumber,8,1)!=SUBSTRING(telenumber,11,1);
查询结果:
telenumber
------------
130****1212
130****2323
130****3434
第二种类型: AABB
select * from telephone where SUBSTRING(telenumber,8,1)=SUBSTRING(telenumber,9,1) and SUBSTRING(telenumber,10,1)=SUBSTRING(telenumber,11,1) and SUBSTRING(telenumber,8,1)!=SUBSTRING(telenumber,11,1);
查询结果:
telenumber
------------
189****1122
189****3344
189****5566
第三种类型: AAAB
select * from telephone where SUBSTRING(telenumber,8,1)=SUBSTRING(telenumber,9,1) and SUBSTRING(telenumber,9,1)=SUBS