Tat*_*nen 417
只需使用表名:
SELECT myTable.*, otherTable.foo, otherTable.bar...
Run Code Online (Sandbox Code Playgroud)
这将选择from myTable和columns foo以及barfrom的所有列otherTable.
Sim*_*mon 36
我真的需要更多的信息,但它将是...
SELECT table1.*, table2.col1, table2.col3 FROM table1 JOIN table2 USING(id)
Run Code Online (Sandbox Code Playgroud)
小智 18
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
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
206646 次 |
| 最近记录: |