如何使用SQL Server在两个不同的列中添加两个单独的查询结果
问题描述:
您好,
我正在尝试从两个不同的列添加两个单独的查询结果
我尝试过:
Hello,
I am trying to add two separated Query result from two different column
What I have tried:
Query1="select column from table1"
Query2="select column from table1"
Result:
table should be like this
Col1-Query1 Col2-Query2
1 1
2 2
3 3
答
您需要做的就是阅读 SQL连接的可视化表示 [ ^ ]。根据情况,您可能需要使用INNER
或LEFT
或RIGHT
或CROSS JOIN
。
All you need to do is to read about Visual Representation of SQL Joins[^]. Depending on situation you may want to useINNER
orLEFT
orRIGHT
orCROSS JOIN
.