使用T-SQL在计算字段上分组

时间:2016-01-28 17:02:34

标签: group-by calculated-columns

我有以下代码:

 select distinct m.property_id,
    m.property_size, 
    count(f.request_id) WOs, 
    round(cast(m.[property_size] as float(10)) / cast((f.[request_id] * 1000) as float(5)),2) as PER_1k_SQFT

from T1 m, T2 f
where m.property_id = f.property_id
and datepart(year,request_date) = '2015'
and datepart(month, f.request_date) = '12'
group by  m.property_id, m.property_size, round(cast(m.[property_size] as float(10)) / cast((f.[request_id] * 1000) as float(5)),2)
order by count(f.request_id) desc

我的最后一栏,PER_SQ_Ft全是零。为什么不填写计算结果呢?

0 个答案:

没有答案