我如何加入2个具有相似但不完全相同的值的表?
我有2个表,我试图在“程序”列(以及其他)上加入。 问题是程序名称并不完全相同 - 但是它们相似。
一个表格可能具有
program1
program2
program3
另一个表的地方可能具有:
xyz-program1-highlights
z-program1-extra
abc-program1
123-program2
3-program2
A-program3
或其对基本上的任何变化
,可以从基本上做一个类似命令来查找table1像table2并加入它们的位置?
我已经尝试过
table1 LEFT JOIN table2
ON table1.program LIKE '%'||table2.program||'%'
(及其一些变化),并且仅与一个程序(在大约30个)中匹配,
以防这很重要,Table2是具有联合视图的视图。
感谢您的帮助!
I have 2 tables that I'm trying to join on the 'program' column (and others).
The issue is that the program names aren't exactly the same-- they're similar though.
Where one tables may have
program1
program2
program3
The other table may have:
xyz-program1-highlights
z-program1-extra
abc-program1
123-program2
3-program2
A-program3
or any variation thereof
Is there a way to basically do a LIKE command to find where table1 is LIKE table2 and join them?
I've tried
table1 LEFT JOIN table2
ON table1.program LIKE '%'||table2.program||'%'
(and some variations thereof) and it only matched one program (out of about 30)
In case this matters, table2 is a view with unioned views.
Thanks for any help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试
此 link 可能会帮助您
You can try
This link might help you