试图在SQL中获取每天的平均值

时间:2015-06-18 17:43:31

标签: sql average

我正在努力获得白天发布的平均工作数,但无法从本网站提出的任何类似的先前问题中找出答案。这似乎很基本,但由于某种原因它不起作用。有人可以帮忙吗?谢谢!

select avg(count(*) 
from select (count(*), to_char(thedate, 'MM/DD/YYYY') as date 
     from jobs where companyid = 1)

1 个答案:

答案 0 :(得分:0)

试试这个:

select avg(jobNumber), date
from select (count(*) as jobNumber, to_char(thedate, 'MM/DD/YYYY') as date
 from jobs
 where companyid = 1
 Group by to_char(thedate, 'MM/DD/YYYY')
) innerSelect
Group by date