从另一个表的列中选择记录等项目 [英] Select items like records from a column in another table
问题描述
我有一个包含大量多条记录的表 (foo),我只想选择那些类似于另一个表 (foo2) 中某个字段中的记录之一
I have a table (foo) with a large number of several records and I only want to select those that are like one of the records in a field in another table (foo2)
如果我使用内部连接进行 SELECT 查询
If I do a SELECT query with an inner join
SELECT pst_qty AS [QTY]
,[MFGPN]
,[mfg_name] AS [MANUFACTURER]
,description
,sup_id
FROM [foo]
INNER JOIN [foo2]
ON [foo].[MFGPN] = [foo2].TestString
afaik 我只会得到 foo.field1=foo2.field1 的记录.我似乎无法使用 ON foo.field1 LIKE foo2.field2 来选择 foo2 中的字段等记录.我将如何选择与不同表中列中的记录相似的记录?
afaik I would only get records where foo.field1=foo2.field1. I can't seem to use ON foo.field1 LIKE foo2.field2 to select records like the fields in foo2. How would I go about selecting the records that are like the records from a column in a different table?
推荐答案
你是否尝试过类似的事情
Have you tried something like
SELECT pst_qty AS [QTY]
,[MFGPN]
,[mfg_name] AS [MANUFACTURER]
,description
,sup_id
FROM [foo]
INNER JOIN [foo2]
ON [foo].[MFGPN] LIKE '%' + [foo2].TestString + '%'
这篇关于从另一个表的列中选择记录等项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!