我在 2 个不同的数据库中有 2 个表:
database1.table1
看起来像:
id | word1
1 test1
2 test2
3 test3
和 database2.table2
看起来像:
price | word2
10 test1
15 test2
30 test3
我如何比较 word1
和 word2
以查看 word2
中的键是否在 word1
中找到mysql 连接或 php
有什么想法吗? 谢谢
最佳答案
SELECT t1.id, t1.word1, t2.price
FROM database1.table1 t1
JOIN database2.table2 t2
ON t1.word1 = t2.word2;
关于php, mysql, 如何比较两个字符串?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7125852/