日期:2014-05-17 浏览次数:20713 次
--mysql 语法不懂,不过LZ下面的这个要求结果,有些让人费解。 /* TIT KEY 大大小小 大大 大大不不 大大 或者 我是好汉 好汉 好汉天使 好汉*/
------解决方案--------------------
declare @text varchar(100) --('你给入的值')
select * from [表]
where INSTR([tit], [key])>0
and key = @text
------解决方案--------------------
set @key='大大';select * from [表] where INSTR([tit], @key)>0 and [key]=@key;
------解决方案--------------------
declare @tab table(TIT varchar(10),KEY varchar(5))
insert @tab
select '大大小小','大大' union all
selcet '大大不不','大大' union all
select '我是好汉','好汉' union all
select '天使好汉','好汉'
go
declare @key varchar(5)
set @key='大大'
select * from @tab where INSTR([TIT], @key)>0 and [key]=@key;
----------------------------
--查询结果
/*
TIT KEY
大大小小 大大
大大不不 大大
*/