Php 从该列存在于另一个表中的表中选择id作为名称

Php 从该列存在于另一个表中的表中选择id作为名称,php,mysql,sql,Php,Mysql,Sql,这就是我的桌子的样子 Table 1 id topic authors_id 1 test 2 2 test2 1 3 test3 4 4 test4 3 Table 2 id author 1 name1 2 name2 3 name3 4 name4 有没有办法从表1中选择authors\u id并将其显示为表2中的author?听起来您想要一个SQL内部联接 select ta

这就是我的桌子的样子

Table 1 
id    topic    authors_id
1     test     2
2     test2    1
3     test3    4
4     test4    3

Table 2
id    author
1     name1
2     name2
3     name3
4     name4

有没有办法从表1中选择authors\u id并将其显示为表2中的author?

听起来您想要一个SQL内部联接

select table1.authors_id,
    table2.author
from table1
inner join table2 on table1.authors_id = table2.author