简体   繁体   English

如何在连接表中选择单个表的所有列?

[英]How to choose all column of a single table in a joined table?

I have a query that is like this:我有一个这样的查询:

SELECT * FROM A JOIN B

Table A and B are almost equal, but I use the join to filter on certain rows.AB几乎相等,但我使用连接来过滤某些行。 Now my result table is having all columns twice, and this is causing referencing trouble where I am using this table.现在我的结果表有两次所有的列,这在我使用这个表的地方引起了引用问题。 Therefore I would like to only show table A 's columns.因此我只想显示表A的列。 Is there a more easy way to achieve this than retyping all column names on the spot of * ?有没有比在*重新键入所有列名更简单的方法来实现这一点?

If you only want the columns from A , then use:如果您只想要A的列,请使用:

select A.*

You can add additional columns as you like:您可以根据需要添加其他列:

select A.*, B.special_column

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

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