"请问如何写 sql 查询语句查找 13 位手机号码所有后四位尾数符合 AABB 或者 ABAB 或者 AAAA 形式的电话号码呢?"
请问如何写 sql 查询语句查找 13 位手机号码所有后四位尾数符合 AABB 或者 ABAB 或者 AAAA 形式的电话号码呢?
以下 sql 语句看下:select phone from PhoneNumwhere (SUBSTRING(phone, 11)=SUBSTRING(phone, 10, 1)andSUBSTRING(phone, 9, 1)=SUBSTRING(phone, 8, 1))or (SUBSTRING(phone, 11)=SUBSTRING(phone, 9, 1)andSUBSTRING(phone, 10, 1)=SUBSTRING(phone, 8, 1))
以下 sql 语句看下:select phone from PhoneNum
where (SUBSTRING(phone, 11)=SUBSTRING(phone, 10, 1)
and
SUBSTRING(phone, 9, 1)=SUBSTRING(phone, 8, 1)
)
or (SUBSTRING(phone, 11)=SUBSTRING(phone, 9, 1)
and
SUBSTRING(phone, 10, 1)=SUBSTRING(phone, 8, 1)
)