select * from T where a like '%你好%' order by (case when a='你好' then 1 else 2 end)
测试 create table #aa(id int not null, a char(20)) insert into #aa select 1 ,'你好' union select 2 , 'fds' union select 3 ,'dfas你好' union select 4 , '你好' union select 5 , 'fd你好fda' union select 6 , '你好fdjsal' union select 7 , '你好'select * from #aa where a like '%你好%' order by len(a)
select * from T where a like '%你好%' 这个好象行不通建议 select * from #aa where a like '%你好%' order by len(a)
select * from t where patindex('%你好%',a )>=1
也可以这样做: select * from t where charindex('你好',a )>=1 select * from t where a like '%你好%'
select * from #aa where charindex('你好',a )>=1 order by len(a)
where a like '%你好%'
order by (case when a='你好' then 1 else 2 end)
create table #aa(id int not null,
a char(20))
insert into #aa select 1 ,'你好'
union select 2 , 'fds'
union select 3 ,'dfas你好'
union select 4 , '你好'
union select 5 , 'fd你好fda'
union select 6 , '你好fdjsal'
union select 7 , '你好'select * from #aa where a like '%你好%' order by len(a)
select * from t where charindex('你好',a )>=1 select * from t where a like '%你好%'
select * from #aa where charindex('你好',a )>=1
order by len(a)