MySQL Select all columns from one table and some from another table

Alex picture Alex · Aug 16, 2010 · Viewed 247k times · Source

How do you select all the columns from one table and just some columns from another table using JOIN? In MySQL.

Answer

Tatu Ulmanen picture Tatu Ulmanen · Aug 16, 2010

Just use the table name:

SELECT myTable.*, otherTable.foo, otherTable.bar...

That would select all columns from myTable and columns foo and bar from otherTable.