SQL code: 现有以字符串如下:字段Description 中一条记录为'RESISTOR-MELF*MF-1OHM*1%*1.5MMX3.6MM-0204' 我想从中查找关键字 Declare @Keyword 当@Keyword='1OHM' 我用如下匹配Description not like '%[*-]'+@Keyword+'[*-]%' 当@Keyword='RESISTOR-MELF*MF-1OHM*1%*1.5MMX3.6MM-0204' 我用Description not like '%'+@Keyword+'%' 我能不能将以上两个查询融合到一个语句中,求助各位大大们
我现在想到的是在Description not like '%[*-]'+@Keyword+'[*-]%'中将[*-]中加上代表空的字符,但是我不知道该怎么写,求教啊~
么懂 来点数据看看
难度好像很高
... SQL code:
select * from tbl where (@Keyword='1OHM' and Description not like '%[*-]'+@Keyword+'[*-]%') or (@Keyword='RESISTOR-MELF*MF-1OHM*1%*1.5MMX3.6MM-0204' and Description not like '%'+@Keyword+'%')
第一句: select ht.gfdm,gfdm.gfmc,gfdm.lb ,sum(jh.htdj*jh.htsl)as je from ht left join gfdm on ht.gfdm=gfdm.gfdm join jh on ht.htbh=jh.hth and ht.htbh not like'del%' and ht. ......