我的加入知识很糟糕,我找不到正确的。我想加入 TableA.userID 和 TableB.otherID 上的两个表以匹配所需的输出。我没有在表上设置任何外键或主键。我应该在这里使用什么?
TableA:
+--------+--------+---------+
| userID | field1 | field2 |
+--------+--------+---------+
TableB:
+--------+----------+---------+---------+---------+
| userID | otherID | myData1 | myData2 | myData3 |
+--------+----------+---------+---------+---------+
Desired Output:
+--------+----------+---------+---------+---------+--------+--------+
| userID | otherID | myData1 | myData2 | myData3 | field1 | field2 |
+--------+----------+---------+---------+---------+--------+--------+