select COUNT(*)/2.0  AS Normal from Table1 group by orderid

解决方案 »

  1.   

    select convert(COUNT(*),float)/2  AS Normal from Table1 group by orderid
      

  2.   

    select convert(float,COUNT(*))/2  AS Normal from Table1 group by orderid
      

  3.   

    5 / 2 = 2
    因为5、2默认为int型,所以结果也为int型5.0 / 2.0 = 2.5 都为float,所以结果为float5 / 2.0 = 2.5   5会转换成float,所以结果为float
      

  4.   

    转换一下就是:
    select cast(COUNT(*)/2.0 as numeric(10,1)) AS Normal from Table1 group by orderid