samedi 9 juillet 2016

SQL count with decimal percentage breakdown - how do you limit to 4 decimal places?

I would like to alter the decimal places to 4 but can't figure it out, help!

--Query

select CASE v2.[ie version]
      When '11' Then 'Internet Explorer 11'
      When '9' Then 'Internet Explorer 9'
      When '8' Then 'Internet Explorer 8'
      Else [IE Version] End [IE Version],
COUNT(distinct v1.guid) 'Total Count', COUNT(*) *100.00 / SUM(COUNT(*)) over()'Total Percentage' from vcomputer v1
inner join vIEVersions v2 on v1.guid = v2.guid where v1.ismanaged = '1'
and v2.[IE Version] is not Null and v2.[IE Version] not in ('Unknown', '7', '10')
group by v2.[IE Version] order by 1 desc

--Output

IE Version               Total Count    Total Percentage
Internet Explorer 9      180            1.7349397590361
Internet Explorer 8      531            5.1180722891566
Internet Explorer 11     9664           93.1469879518072

Aucun commentaire:

Enregistrer un commentaire