SELECT id, name,phone_number from contacts where ((phone_number like '__________'and length(phone_number) =10 and (substr(phone_number ,1,1) in (1,2,3,4,5,6,7,8,9) and substr(phone_number ,2,1) in (1,2,3,4,5,6,7,8,9,0) and substr(phone_number ,3,1) in (1,2,3,4,5,6,7,8,9,0) and substr(phone_number ,4,1) in (1,2,3,4,5,6,7,8,9,0) and substr(phone_number ,5,1) in (1,2,3,4,5,6,7,8,9,0) and substr(phone_number ,6,1) in (1,2,3,4,5,6,7,8,9,0) and substr(phone_number ,7,1) in (1,2,3,4,5,6,7,8,9,0) and substr(phone_number ,8,1) in (1,2,3,4,5,6,7,8,9,0) and substr(phone_number ,9,1) in (1,2,3,4,5,6,7,8,9,0) and substr(phone_number ,10,1) in (1,2,3,4,5,6,7,8,9,0) )) or (phone_number like '___-___-____' and length(phone_number) =12) and (substr(phone_number ,1,1) in (1,2,3,4,5,6,7,8,9) and substr(phone_number ,2,1) in (1,2,3,4,5,6,7,8,9,0) and substr(phone_number ,3,1) in (1,2,3,4,5,6,7,8,9,0) and substr(phone_number ,4,1) in (1,2,3,4,5,6,7,8,9,0,'-') and substr(phone_number ,5,1) in (1,2,3,4,5,6,7,8,9,0) and substr(phone_number ,6,1) in (1,2,3,4,5,6,7,8,9,0) and substr(phone_number ,7,1) in (1,2,3,4,5,6,7,8,9,0,'-') and substr(phone_number ,8,1) in (1,2,3,4,5,6,7,8,9,0) and substr(phone_number ,9,1) in (1,2,3,4,5,6,7,8,9,0) and substr(phone_number ,10,1) in (1,2,3,4,5,6,7,8,9,0) and substr(phone_number ,11,1) in (1,2,3,4,5,6,7,8,9,0) and substr(phone_number ,12,1) in (1,2,3,4,5,6,7,8,9,0) )) and phone_number not like '0%' order by id 这样子才对,你的无法真正限制住
6

相关推荐

牛客网
牛客网在线编程
牛客网题解
牛客企业服务