开发者

T-SQL How to get SUM() from a subquery

开发者 https://www.devze.com 2023-01-16 17:52 出处:网络
I need fast answer (I can\'t check that code right now): is that query works ? I need to get the total sum of a column values from the subquery, something like that:

I need fast answer (I can't check that code right now):

is that query works ? I need to get the total sum of a column values from the subquery, something like that:

  select su开发者_StackOverflow中文版m(select time from table) as sometimes group by sometimes


That doesnot work, try this

select sum(time) as sumtime from table


select avg(field_val)
from table1
where field_val in (
  SELECT TOP 3 field_val
  FROM table1
  ORDER BY field_val DESC
)


That isn't a subquery. You only have 1 from...

0

精彩评论

暂无评论...
验证码 换一张
取 消