Mysql怎么做?

时间:2010-02-13 01:59:49

标签: mysql

我需要从表中选择记录,但是一个字段(例如id2)替换为来自第一个表中id == id2的其他表的值

1 个答案:

答案 0 :(得分:1)

如果要从另一个表列中存在列值的表中选择行,则需要使用JOIN:

SELECT * FROM table1 INNER JOIN table2 ON table1.id = table2.id2

Read this blog post by Jeff Atwood on the different joins

相关问题