与喜欢的运算符一起加入内部?

时间:2019-03-28 10:48:52

标签: sql ms-access

我正在使用访问权限,并尝试创建一个sql查询。

基本上,我有两个要加入的表。第一个具有名称和值的“缩写形式”。第二个具有名称的“复杂形式”和另一个值。

表格如下:

Test_Tabelle1

Feld1; Feld2

asdf;14
test;21

Test_Tabelle2

Feld1; Feld2

asdf_1;16
asdf_2;16
test_1;24
test_2;22

结果应如何显示

Test_Tabelle2.Feld1; Test_Tabelle1.Feld2

asdf_1;14
asdf_2;14
test_1;21
test_2;21

基本上:如果“ asdf”(来自Test_Tabelle1.Feld1)是Test_Tabelle2.Feld1的一部分,则应将两者都加入。与“测试”相同。如何获得结果?

我尝试了以下似乎正确的代码,但没有得到任何结果。

SELECT Test_Tabelle2.Feld1, Test_Tabelle1.Feld2
FROM Test_Tabelle1
INNER JOIN Test_Tabelle2 ON Test_Tabelle2.Feld1 LIKE ("%" & Test_Tabelle1.Feld1 & "%");

1 个答案:

答案 0 :(得分:4)

MS-Access使用*的{​​{1}}

https://support.office.com/en-gb/article/like-operator-b2f7ef03-9085-4ffb-9829-eef18358e931

(我讨厌MS-Access的许多原因之一,它太专有了)

相关问题