小问题,关于sql语法两数相除 select COUNT(*)/2.0 AS Normal from Table1 group by orderid 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select convert(COUNT(*),float)/2 AS Normal from Table1 group by orderid select convert(float,COUNT(*))/2 AS Normal from Table1 group by orderid 5 / 2 = 2因为5、2默认为int型,所以结果也为int型5.0 / 2.0 = 2.5 都为float,所以结果为float5 / 2.0 = 2.5 5会转换成float,所以结果为float 转换一下就是:select cast(COUNT(*)/2.0 as numeric(10,1)) AS Normal from Table1 group by orderid SQL Server乱码问题 大家帮下! 求一下 字段值累加~~ 各位大侠帮忙看一下这个sql语句错在哪?急呀! SQL server 2008无法新建数据库 如何取得一个数据库中每个用户表的行数及所占用磁盘空间! 求助!!数据库的范式.... 关于多表查询 请问有没有更好的办法来解决查询一张表的所有字段是否含有某个值,急急急 sql 关于记录某字段不能重复,而其他可以为空的查询问题,帮忙一下,谢谢 在存储过程中,能否在select的from后的表名,使用@tab这样的变量
因为5、2默认为int型,所以结果也为int型5.0 / 2.0 = 2.5 都为float,所以结果为float5 / 2.0 = 2.5 5会转换成float,所以结果为float
select cast(COUNT(*)/2.0 as numeric(10,1)) AS Normal from Table1 group by orderid