select * from table1 join table2 on table1.column3=table2.column4 where ...
...
$row=mysql_fetch_assoc($result);
Run Code Online (Sandbox Code Playgroud)
但是,新表(table1 join table2)中有两列具有相同的列名,如何分别获取两者的值?
使用类似的别名专门调用columsn
SELECT table_1.id as table_1_id, table_2.id as table_2_id
您必须以这种方式从至少一个表中列出所有或大多数列,但您可以在多个表中访问具有相同名称的cols.