如何在SQL中将其转换为小数?下面是等式,我得到答案为78(整数),但真正的答案是78.6(带小数)所以我需要显示这个,否则报告将不会达到100%
(100 * [TotalVisit1]/[TotalVisits]) AS Visit1percent
LeppyR64.. 19
试试这个:
(100.0 * [TotalVisit1]/[TotalVisits]) AS Visit1percent
Shawn.. 8
convert(decimal(5,2),(100 * convert(float,[TotalVisit1])/convert(float,[TotalVisits]))) AS Visit1percent
丑陋,但它的工作原理.
试试这个:
(100.0 * [TotalVisit1]/[TotalVisits]) AS Visit1percent
convert(decimal(5,2),(100 * convert(float,[TotalVisit1])/convert(float,[TotalVisits]))) AS Visit1percent
丑陋,但它的工作原理.