日期:2014-05-18 浏览次数:20644 次
declare @sql varchar(1000) select @sql=isnull(@sql,'')+'or'+'"'+rtrim(KEYWORD)+'"' from TEM group by KEYWORD set @sql=STUFF(@sql,1,2,'') set @sql='select * from ttt where contains(title,'''+@sql+''')' exec (@sql)
------解决方案--------------------
你的想法实现不了
唯一的方法--用游标:
游标读取SELECT DISTINCT KEYWORD FROM TEM
对每个KEYWORD ,insert #temp select title from ttt where contains(TITLE,'KEYWORD')
最后显示数据,select distinct title from #temp