开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜