-1
The Stack Exchange Data Explorer允許針對堆棧Exchange數據庫執行SQL查詢。下面query —在數據資源管理器中獲取非整數結果
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 — courtesy產生的所有整數值的結果:一切變得圓形的或者截斷(我不知道是哪個)。 (這在wh
列中特別討厭,因此每個值都是0
。)有沒有辦法強制使用小數或值?
謝謝!這樣可行。 – msh210