如何使用来自2个MySQL表的类似但不同格式的列将其加入一个MySQL表?
我想知道如何根据名为“ Chamber_id”的列将2个表加入一张表格,但是,具有2种不同格式。表A的列带有格式:SG_QRA_SGHAST_0001、0002等。并且表B具有相同的列,其格式为:SGHAST.0001、0002等。有人知道如何启动此复杂任务以及我应该使用哪种语言( python也许?)?谢谢你!
I wanna know how to join 2 tables into one based on a column named 'Chamber_ID', however, with 2 different formats. Table A has the column with the format: SG_QRA_SGHAST_0001, 0002, etc. and Table B has the same column with format like: SGHAST.0001, 0002, etc. Does anyone know how to start this complicated task and which language should I use (Python perhaps?)? Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果字母是静态的,并且唯一变化的是数字,
您可以将最后4个字符的子字符串划分,这将使您仅留下数字(带有领先的零),然后可以比较它们('0001'='0001')
:
如果您喜欢内部的加入语法:
In case the letters are static and the only thing that changes are the numbers,
you can take a substring of the last 4 characters, which will leave you with the numbers only (with leading zeros), and then you can compare them ('0001' = '0001')
for example:
If you prefer inner join Syntax: