在通配符 where 子句中使用 Select 语句
在 MS SQL 2005 中工作,我想在通配符 where 子句中使用 select 语句,如下所示:
SELECT text
FROM table_1
WHERE ID LIKE '%SELECT ID FROM table_2%'
我正在数据库中保存的大量文本中查找产品 id。通配符子句中的 SELECT 语句将返回 50 多行。上面的说法显然不是正确的做法。有什么建议吗?
Working in MS SQL 2005 and I want to use a select statement within a wildcard where clause like so:
SELECT text
FROM table_1
WHERE ID LIKE '%SELECT ID FROM table_2%'
I'm looking for product ids within a large body of text that is held in a DB. The SELECT statement in the wildcard clause will return 50+ rows. The statement above is obviously not the way to go. Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以根据 table_2 进行连接并构造类似的字符串。
You can do a join and construct the like string based on table_2.