简体   繁体   English

项目的平均响应时间

[英]Average Response time of items

Its a very basic question, and I am just confused. 这是一个非常基本的问题,我只是感到困惑。

Response Time | Item
    2           1
    3           1
    4           1
    1           1 
    4           2 
    4           2 
    4           2
    8           2
    1           3

If column A is the number of days takes by each item (column B) . 如果A列是每个项目花费的天数(B列)。 What is the average response time of each item in column B and the total average response time. B列中每个项目的平均响应时间是多少,以及总平均响应时间是多少。

should be easy like: 应该很容易像:

SELECT Item
      ,SUM(ResponseTime) AS Total_ResponseTime
      ,AVG(ResponseTime) AS Average_ResponseTime
      ,(SELECT AVG(ResponseTime) FROM mytab) as Total_Average_ResponseTime
  FROM yourtable
GROUP BY Item

If you wanna reproduce my result, you can use this link: http://rextester.com/LIV1334 如果您想复制我的结果,可以使用此链接: http : //rextester.com/LIV1334

is this what you're looking for? 这是您要找的东西吗?

select item, avg([respone time]) 
from items
group by item

Something like this: 像这样:

SELECT item, AVG(response_time)
FROM table
GROUP BY item

This is pretty straight forward aggregation. 这是非常简单的聚合。 https://docs.microsoft.com/en-us/sql/t-sql/functions/avg-transact-sql https://docs.microsoft.com/zh-cn/sql/t-sql/functions/avg-transact-sql

select AVG(ResponseTime)
    , Item
from YourTable
group by Item

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM