select * from table1 join table2 on table1.column3=table2.column4 where ...
...
$row=mysql_fetch_assoc($result);
However, there are two columns in the
When there's a column name collision due to a query joining 2+ tables, you can not use *
. You can use:
SELECT table_1.*,
table_2.*
FROM table_1,
table_2
If that doesn't return the list of columns you want, you will have to explicitly list every column. There's no way around - it's an all or nothing deal.
...but typing out the full table name every time can be a pain, which is why you can alias tables:
SELECT t1.*,
t2.*
FROM table_1 AS t1,
table_2 t2
Either alias notation is supported. They're also required if you want to join a table to itself.