堆栈交换数据资源管理器允许对一个Stack Exchange数据库的SQL查询。 下面的查询 -
select
month(CreationDate) month,
year(CreationDate) year,
sum(case when lower(left(Title,2))='wh' then 1 else 0 end)/count(*) wh,
(select sum(Score)/count(*)
from Posts u
where
month(CreationDate)=month(t.CreationDate) and
year(CreationDate)=year(t.CreationDate) and
lower(left(Title,2))='wh' and
PostTypeId=1 -- question
) wh_score,
sum(Score)/count(*) score,
(select sum(AnswerCount)/count(*)
from Posts u
where
month(CreationDate)=month(t.CreationDate) and
year(CreationDate)=year(t.CreationDate) and
lower(left(Title,2))='wh' and
PostTypeId=1 -- question
) wh_answers,
sum(AnswerCount)/count(*) answers
from Posts t
where PostTypeId=1 -- question
group by month(CreationDate), year(CreationDate)
;
- 礼貌的Scorpi0 -产生的结果的所有整数值:一切变得舍入或截断(我不知道是哪个)。 (这是最令人讨厌的wh
列,其中每个值因此0
。)有没有办法来强制十进制或值?