如何在table1的指定列之后将table2中的列连接到table1? [英] How to join column from table2 to table1 after a specified column of table1?
问题描述
它工作,但它将列放在datagridview的末尾,但我必须在table2的指定列之后放入table2.column1,并且我必须使用table1。*并且我不能使用table1的列表列是可能的吗?
我尝试过:
我有这样的查询:选择table1。*,table2.column1 from table1 join table2 on table1.column1 = table2.column1
it works, but it puts the column in the end of the datagridview, but i have to put table2.column1, after a specified column of table2, and i have to use table1.* and i cant use listing of the table1's columns is it possible?
What I have tried:
I have a query like this: Select table1.*, table2.column1 from table1 join table2 on table1.column1=table2.column1
推荐答案
你需要列出的列表1明确。这允许您将table2列放置到特定位置。
类似于:
You need to list the columns of table 1 explicitly. This allows you to place the table2 column to a specific place.
Something like:
select table1.col1, table1.col2, table2.column1, table1.col3, table1.xyz ...
from table1 join table2 on table1.column1=table2.column1
注意:无论哪种方式,它明确列出列是一个很好的实践,而不是使用*。
更难的方法:重新排列网格列...
我希望这会有所帮助。
Note: Either way, it is a good praxis to explicit list the columns and not use "*".
The harder way: rearrange the grid columns...
I hope this helps.
这篇关于如何在table1的指定列之后将table2中的列连接到table1?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!