只需使用表名:
SELECT myTable.*, otherTable.foo, otherTable.bar...
这将选择 myTable
中的所有列以及 otherTable
中的列 foo
和 bar
。
我真的需要更多信息,但它会沿着..
SELECT table1.*, table2.col1, table2.col3 FROM table1 JOIN table2 USING(id)
select a.* , b.Aa , b.Ab, b.Ac from table1 a left join table2 b on a.id=b.id
这应该选择表 1 中的所有列,并且仅选择表 2 中由 id 连接的列出的列。
使用别名来引用表以在加入它们后从不同的表中获取列。
Select tb1.*, tb2.col1, tb2.col2 from table1 tb1 JOIN table2 tb2 on tb1.Id = tb2.Id
不定期副业成功案例分享