如果连接值包含文本,则选择SELECT行

时间:2016-01-12 16:05:20

标签: sql-server tsql select where

select dbo.strconcat(r.Name) as Names, r.Category
from Reference r
group by r.Category

对于此查询,我需要获取至少有一个名称(r.Name)LIKE任何文本的类别。

示例:condition(LIKE'%123%')

123,2,4 - 更正名称

1 个答案:

答案 0 :(得分:0)

这就是你要找的东西:

;WITH A
     AS
        (SELECT dbo.strconcat
                (r.Name
                ) AS Names, r.Category
         FROM Reference r
         GROUP BY r.Category
        )
     SELECT *
     FROM A
     WHERE Names LIKE '%123%';