使用 LIKE 的表驱动 WHERE 子句
我所拥有的:
WHERE (dbo.Field1 LIKE '% contact made %' OR dbo.Field1 LIKE '% talked to %')
我需要类似以下内容:
WHERE (dbo.Field1 LIKE IN (SELECT Pattern FROM PatternTable))
PatternTable
------------
% contact made %
% talked to %
% called in %
% spoke with %
% spoke to %
类似的问题是 SQL Where 子句 with LIKE 和 IN。
What I have:
WHERE (dbo.Field1 LIKE '% contact made %' OR dbo.Field1 LIKE '% talked to %')
I need something like the following:
WHERE (dbo.Field1 LIKE IN (SELECT Pattern FROM PatternTable))
PatternTable
------------
% contact made %
% talked to %
% called in %
% spoke with %
% spoke to %
Similiar question is SQL Where Clause with LIKE and IN.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 Oracle 中你可以这样做,
我认为这在 SQL Server 中也可以工作。
In Oracle you can do
I would think this will work in SQL Server as well.
看起来您需要使用动态sql:
http://www.dba-sql- server.com/sql_server_tips/t_super_sql_460_dynamic_sql.htm
Looks like you need to use dynamic sql:
http://www.dba-sql-server.com/sql_server_tips/t_super_sql_460_dynamic_sql.htm