[英]Sum of SubQuery Column
I need to get the Sum of SubQuery Column. 我需要得到子查询列的总和。 Here is what I am using, but it is giving error, 这是我正在使用的,但它给出了错误,
SELECT SUM (SELECT Col1 From Table1) FROM Table 2
Since you are not selecting anything from Table2, you can just do: 由于您没有从Table2中选择任何内容,您可以这样做:
select sum(Col1)
from Table1
Otherwise, you can do it like this: 否则,您可以这样做:
select (
select sum(Col1)
from Table1
) as SumTable1Col1,
Table2.SomeOtherCol
from Table2
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.