1、如何从一批手机号码中,选出最后4位不能含有“4”的号码,就是最后4位任意一位都不带有“4”
这个号码,并且手机的前面7位必须是:1381508的所有号码。用like实现,晕,搞了半天,搞不出来。我发出我写的sql:SELECT *
FROM SystemNumber
WHERE (MobileNumber LIKE '1381508%') AND (MobileNumber NOT LIKE '%4444')以上这句执行后,依然会输出尾数带'4'的号码
这个号码,并且手机的前面7位必须是:1381508的所有号码。用like实现,晕,搞了半天,搞不出来。我发出我写的sql:SELECT *
FROM SystemNumber
WHERE (MobileNumber LIKE '1381508%') AND (MobileNumber NOT LIKE '%4444')以上这句执行后,依然会输出尾数带'4'的号码
解决方案 »
- Sql Server备份数据库是提示:已添加了具有相同键的项。
- xml的modify方法的delete关键字使用
- 关于sql 默认值函数
- 2004-7到2005-2为学校一个学期,怎么获得学周
- 怎样判断表中的列'AA'是否存在,如果不存在就,增加一列'AA' 请问怎么实现??
- SQL语句该怎么写
- (高分求教!)SQL Server是否可以把一个表的结构和数据一起dump出来?急!
- 关于SQL SERVER 存储过程取不到值的问题
- 一个关于数据还原的问题,请帮帮我这个帅哥吧
- 一个把数据导入到Excel的问题,急!急!急.........
- 数据库记录提取的问题? 在线等待!!!!!!!!!
- 请问SQL SERVER2005能不能把数据库备份写成存储过程吗?
SELECT *
FROM SystemNumber
WHERE
(MobileNumber LIKE '1381508%') AND
right(MobileNumber,4) NOT LIKE '%4%'
SELECT *
FROM SystemNumber
WHERE
left(MobileNumber,7)='1381508' AND
charindex('4',right(MobileNumber,4))=0
from 表2 a
where not exists ( select 1 from 表1 b where a.字段A=b.字段A and a.字段B=b.字段B and a.字段C=b.字段C)create table tba( num varchar(11))insert into tba values('13815084444')
insert into tba values('13311381508')
insert into tba values('13815084111')
insert into tba values('13815080002')insert into tba values('13815080040')select *
from tba
where num like '1381508%' and substring(num,8,4) not like '%4%'
select convert(bigint,phoneCode ) from tableName
where convert(bigint,phoneCode) like '%4___'
orconvert(bigint,phoneCode) like '%_4__'
orconvert(bigint,phoneCode) like '%__4_'
or convert(bigint,phoneCode) like '%___4'现在的问题是,最后四位号码出现“4”的位置是由客户自己选择的,他可能要前面两位,也可能只要中间一位带4的,就是4的位置是不固定的,我应该怎么写呢???我已经做了4个文本框给客户选择,一般来说,客户不可能全部填写4的。