Mysql SQL查询注册表。匹配
我在确定什么请求(MySQL)适合这种要求时遇到了一个小问题: 表1Mysql SQL查询注册表。匹配,mysql,sql,regex,Mysql,Sql,Regex,我在确定什么请求(MySQL)适合这种要求时遇到了一个小问题: 表1 +++++++++++++++++ id| name +++++++++++++++++ 1 | John Smith 2 | Eric Smith 3 | Martha Smith 4 | Smith 5 | Ronald Smith Donald 6 | Marc Fisher 表2 +++++++++++++++++++++++ regex | value1 | value2 +++++++++++++++++++++
+++++++++++++++++
id| name
+++++++++++++++++
1 | John Smith
2 | Eric Smith
3 | Martha Smith
4 | Smith
5 | Ronald Smith Donald
6 | Marc Fisher
表2+++++++++++++++++++++++
regex | value1 | value2
+++++++++++++++++++++++
Smith | Mister | 356
Fisher| Sir | 24
选择结果值作为
结果集+++++++++++++++++++++++++++++++++++++++++++++++++++
id| name | regex | value1 | value2
+++++++++++++++++++++++++++++++++++++++++++++++++++
1 | John Smith | Mister | 356
2 | Eric Smith | Mister | 356
3 | Martha Smith | Mister | 356
4 | Smith | Mister | 356
5 | Ronald Smith Donald | Mister | 356
6 | Marc Fisher | Sir | 24
提前感谢。您可以使用MySQL:
如果一个名称与表2中的多个
regex
匹配,就会发生有趣的事情。是的,找到了,谢谢,可能会解决。由于我一直使用T-SQL,我不知道MySQL有这样的功能:)
select *
from Table1 t1
join Table2 t2
on t1.name regexp t2.regex