简体   繁体   English

在Postgresql中加入2表,但另一个表将仅提取其列

[英]Join 2 Table in postgresql but the other table only will extract its columns

当您join 2 Table但仅使用'*'符号提取第一个表的列时,postgres中是否有办法?这意味着第一个表的所有列。

I will answer this one because I solved it by the help of Mr.@Gordon Linoff. 我将回答这个问题,因为我是在@Gordon Linoff先生的帮助下解决的。

I use the alias of the table and use it in the * symbol. 我使用表的alias ,并在*符号中使用它。

sample code below: 下面的示例代码:

SELECT a.* FROM table_a as a join table_b as b ON a.id=b.id;

This will only extract the data of table_a . 这只会提取table_a的数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM