关键字的选择,求SQL语句
关键字querytext字段 
 其中一条存放的比如         人物,房子,大自然   
 1   人类 
 2   天气,人物 
 3   自然,车和房 
 4   房子,大自然 
 5   大自然真美   
 我想把querttext拆分,然后选择出来和他匹配的相关内容出来,比如刚才选出来就是 
 2   天气,人物 
 4   房子,大自然   
 注意,第三条没有选择出来,第五条也没有选择出来,虽然第五条包括了大自然,但是他的整体是大自然真美,按照整体的选   
 这样的SQL怎么写?高手帮忙 
------解决方案----------------------3.2.1 循环截取法 
 CREATE FUNCTION f_splitSTR( 
 @s   varchar(8000),   --待分拆的字符串 
 @split varchar(10)     --数据分隔符 
 )RETURNS @re TABLE(col varchar(100)) 
 AS 
 BEGIN 
 	DECLARE @splitlen int 
 	SET @splitlen=LEN(@split+ 'a ')-2 
 	WHILE CHARINDEX(@split,@s)> 0 
 	BEGIN 
 		INSERT @re VALUES(LEFT(@s,CHARINDEX(@split,@s)-1)) 
 		SET @s=STUFF(@s,1,CHARINDEX(@split,@s)+@splitlen, ' ') 
 	END 
 	INSERT @re VALUES(@s) 
 	RETURN 
 END 
 GO   
 create table t1(cp int,name varchar(100))   
 insert t1 
 select 1, '人类 ' union all 
 select 2, '天气,人物 ' union all 
 select 3, '自然,车和房 ' union all 
 select 4, '房子,大自然 ' union all 
 select 5, '大自然真美 '      
 select a.*  
 from t1 a,(SELECT  
 dbo.f_splitSTR(userinfo, ', ', 1) as c1, 
 dbo.f_splitSTR(userinfo, ', ', 2) as c2, 
 dbo.f_splitSTR(userinfo, ', ', 3) as c3 
 FROM( 
 SELECT userinfo =  '人物,房子,大自然 ' 
 )c ) b 
 where 	charindex( ', '+b.c1+ ', ', ', '+name+ ', ')> 0 or  
 	charindex( ', '+b.c2+ ', ', ', '+name+ ', ')> 0 or  
 	charindex( ', '+b.c3+ ', ', ', '+name+ ', ')> 0   
------解决方案--------------------if object_id( 'pubs..tbA ') is not null 
    drop table tbA 
 go 
 create table tbA(string varchar(10))   
 if object_id( 'pubs..tbB ') is not null 
    drop table tbB 
 go 
 create table tbb(id int, string varchar(20)) 
 insert into tbB(id,string) values(1,  '人类 ') 
 insert into tbB(id,string) values(2,  '天气,人物 ') 
 insert into tbB(id,string) values(3,  '自然,车和房 ') 
 insert into tbB(id,string) values(4,  '房子,大自然 ') 
 insert into tbB(id,string) values(5,  '大自然真美 ') 
 go   
 declare @Days varchar(4000) 
 declare @tmpDay varchar(10) 
 set @Days= '人物,房子,大自然 ' 
 set @tmpDay= ' ' 
 declare @i int 
 set @i=0 
 while @i <len(@Days) 
 begin  
   set @i=@i+1 
   if SUBSTRING(@Days,@i,1)= ', ' 
      begin 
        insert into tba(string) values( left(@Days,@i-1)) 
        set @Days=SUBSTRING(@Days,@i+1,len(@Days)) 
        set @i=0 
      end   
 end 
 insert into tba(string) values(@Days)   
 select distinct tbb.* from tbb,tba where charindex( ', ' + tba.string +  ', ',  ', ' + tbb.string +  ', ') >  0   
 drop table tbA,tbB   
 /* 
 id          string                
 ----------- --------------------  
 2           天气,人物 
 4           房子,大自然   
 (所影响的行数为 2 行) 
 */
------解决方案--------------------/**************************************** 
 --功能:分割字符串,返回字符串记录集 
 --@Str:要分割的字符串 
 --@Split:分割字符 
 --@Dist:是否去除重复项 
 *****************************************/ 
 if not object_id( 'GetRecords ') is null 
 	drop function GetRecords 
 go   
 create  function  GetRecords( 
 @str  varchar(4000), 
 @split nvarchar(40), 
 @Dist bit)