SQL:如何从 CTE 中选择至少一个类似的值
continue
I created a CTE of distinct string values and I want to select from dataset only values (strings) that contains at least one of strings from the CTE.
I need some kind of in multiple like from CTE.
Example:
say we have @data_1, @data_2 and CTE
with CTE as (
select distinct words
from @data_1
)
I want to select only values from @data_2 that contains at least one of the words in the CTE.
if CTE contains:
'one',
'two',
'three'
and @data_2 contains: 'one hundred', 'two thousend', 'thirty'
SELECT only the values- 'one hundred', 'two thousend'
Is there a way to do that (with use of CTE and not LIKE singular values)?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
continue
You can write
NB: if there were duplicates in the CTE this would return duplicate rows.