That would select all columns from myTable and columns foo and bar from otherTable.
42
votes
I need more information really but it will be along the lines of..
SELECT table1.*, table2.col1, table2.col3 FROM table1 JOIN table2 USING(id)
17
votes
select a.* , b.Aa , b.Ab, b.Ac
from table1 a
left join table2 b on a.id=b.id
this should select all columns from table 1 and only the listed columns from table 2 joined by id.
3
votes
Using alias for referencing the tables to get the columns from different tables after joining them.
Select tb1.*, tb2.col1, tb2.col2 from table1 tb1 JOIN table2 tb2 on tb1.Id = tb2.Id
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.OkRead more