SQL:将``n''扩展为``ike''

问题描述

如果您在表2的文本列中有通配符表达式,则可以这样做。

select *
from Table1 as T1
where exists (select *
              from Table2 as T2
              where T1.[text] like T2.[text])

否则,您需要%在查询中添加。

select *
from Table1 as T1
where exists (select *
              from Table2 as T2
              where T1.[text] like '%'+T2.[text]+'%')

解决方法

我有一个SQL选择如下:

select * from table1 where text in (select text from table2)

实际中 在这个 更复杂的选择中。text是字符串(varchar)。如何扩展该sql以从中选择行table1text 就像
文本来自table2(而不是完全等于)?

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...