简体   繁体   English

如何使用内部连接使用 2 个变量字段?

[英]How use inner join using 2 variable field?

I have 2 tables ABC and XYZ I want to inner join the with name field.我有 2 个表 ABC 和 XYZ 我想内部加入 with name 字段。

ABC table ABC表

     Name     Address     Phone
   Nirdosh    Kth         96749343
   Hari       pokhara     98493434

XYZ table XYZ表

    Name      Address   Phone
   Shrestha    Daldale  96749343
    Hari       pokhara     98493434

I use INNER JOIN我使用内部连接

select actual.*,more.* 
from ABC actual 
INNER JOIN Xyz more 
ON like %'actual.Name'% = like %'more.Name'%  

Are you saying more.Name is more or like actual.Name, but need not be exactly the same as actual.Name?你是说more.Name更或类似actual.Name,但不必为actual.Name完全一样?

select actual.*, more.*
from ABC actual 
inner join XYZ more on more.Name like concat('%', trim(actual.Name), '%')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM