0 results for
exterior
securing
for
white
silicone
sealant
1043 NULL NULL C
1043 NULL B NULL
1043 A B C
I am 2005 also
exterior
securing
for
white
silicone
sealant
1043 NULL NULL C
1043 NULL B NULL
1043 A B C
I am 2005 also
PRINT '@Result = "' + @Result + '"';
declare @word1 varchar(501) declare @word2 varchar(501) declare @word3 varchar(501) DECLARE @Result varchar(3) set @word1 = '%white%'; set @word2 = '%silicone%'; set @word3 = '%sealant%'; SET @Result = CASE '' WHEN @word2 THEN 'A' WHEN @word3 THEN 'AB' ELSE 'ABC' END; SELECT @Result AS [@Result]; SELECT DISTINCT PT_ProductID , CASE WHEN PT_Value LIKE @Word1 THEN 'A' ELSE NULL END AS [MatchA] , CASE WHEN (@Word2 > '') AND (PT_Value LIKE @Word2) THEN 'B' ELSE NULL END AS [MatchB] , CASE WHEN (@Word3 > '') AND (PT_Value LIKE @Word3) THEN 'C' ELSE NULL END AS [MatchC] FROM [ProductText] WHERE (PT_Type In('0','11')) AND ((PT_Value LIKE @Word1) OR (PT_Value LIKE @Word2) OR (PT_Value LIKE @Word3)); SELECT PT_ProductID , ISNULL(MAX([MatchA]), '') + ISNULL(MAX([MatchB]), '') + ISNULL(MAX([MatchC]), '') AS [Comparator] FROM ( SELECT DISTINCT PT_ProductID , CASE WHEN PT_Value LIKE @Word1 THEN 'A' ELSE NULL END AS [MatchA] , CASE WHEN (@Word2 > '') AND (PT_Value LIKE @Word2) THEN 'B' ELSE NULL END AS [MatchB] , CASE WHEN (@Word3 > '') AND (PT_Value LIKE @Word3) THEN 'C' ELSE NULL END AS [MatchC] FROM [ProductText] WHERE (PT_Type In('0','11')) AND ((PT_Value LIKE @Word1) OR (PT_Value LIKE @Word2) OR (PT_Value LIKE @Word3)) ) AS cte GROUP BY PT_ProductID HAVING (ISNULL(MAX([MatchA]), '') + ISNULL(MAX([MatchB]), '') + ISNULL(MAX([MatchC]), '') = @Result); GO
declare @word1 varchar(501) declare @word2 varchar(501) declare @word3 varchar(501) DECLARE @Result varchar(3) set @word1 = '%white%'; set @word2 = '%silicone%'; set @word3 = '%sealant%'; SET @Result = CASE '' WHEN @word2 THEN 'A' WHEN @word3 THEN 'AB' ELSE 'ABC' END; SELECT PT_ProductID FROM ( SELECT DISTINCT PT_ProductID , CASE WHEN PT_Value LIKE @Word1 THEN 'A' ELSE NULL END AS [MatchA] , CASE WHEN (@Word2 > '') AND (PT_Value LIKE @Word2) THEN 'B' ELSE NULL END AS [MatchB] , CASE WHEN (@Word3 > '') AND (PT_Value LIKE @Word3) THEN 'C' ELSE NULL END AS [MatchC] FROM [ProductText] WHERE (PT_Type In('0','11')) AND ((PT_Value LIKE @Word1) OR (PT_Value LIKE @Word2) OR (PT_Value LIKE @Word3)) ) AS cte GROUP BY PT_ProductID HAVING (ISNULL(MAX([MatchA]), '') + ISNULL(MAX([MatchB]), '') + ISNULL(MAX([MatchC]), '') = @Result); GO
PT_ProductID PT_Type PT_Value 12665 0 White 12665 0 Silicone 12665 11 Sealant 12734 0 White 12734 31 Silicone 12734 11 Sealant
Comment