1.
数据
56A4
56A4
56AA0A
56AA1A
值的位数是固定的,我想where出前面三位包含'56A',又是56AA01A格式的数据,where怎么写2.
数据
56G10N我想where出包含56g的怎么写?
数据
56A4
56A4
56AA0A
56AA1A
值的位数是固定的,我想where出前面三位包含'56A',又是56AA01A格式的数据,where怎么写2.
数据
56G10N我想where出包含56g的怎么写?
--用临时表的id int identity,生成序号,得到前3个即可。
2、
select * from tablename where 数据 like '%56g%'
declare @table table (数据 varchar(6))
insert into @table
select '56A4' union all
select '56A4' union all
select '56AA0A' union all
select '56AA1A'create table #t (id int identity,数据 varchar(6))
insert into #t select * from @table
select top 3 * from #t where left(数据,3)='56A' order by id
/*
id 数据
----------- ------
1 56A4
2 56A4
3 56AA0A
*/
drop table #t
select * from tb where 列名 like '56A%' and len(列名)=len('56AA01A')
--2.我想where出包含56g的怎么写
select * from tb where 列名 like '56g%'
where 数据 ='56AA01A'
2
where 数据 like '%56g%'
select * from tablename where 数据 like '%56g%'