例:selectstr(convert(float,(@czcj/@ckrs)*100))+'%'as机试合格率输出显示:87%,但是想要后面保留两位小数如:87%.12。谢谢解答!87.12%declare@ckrsfloatdeclare@czcjfloatdeclar...
例:select str(convert(float,(@czcj/@ckrs)*100))+'%' as 机试合格率
输出显示:87%,但是想要后面保留两位小数如:87%.12。
谢谢解答!
87.12%
declare @ckrs float
declare @czcj float
declare @bscj float
declare @hgrs float
declare @qkrs float
select @ckrs=count(*) from 计算机考试成绩201112 where 院系名称='旅游系'
select @czcj=count(*) from 计算机考试成绩201112 where 院系名称='旅游系' and 操作成绩>='60'
select @bscj=count(*) from 计算机考试成绩201112 where 院系名称='旅游系' and 理论成绩>='60'
select @hgrs=count(*) from 计算机考试成绩201112 where 院系名称='旅游系' and (理论成绩>='60' and 操作成绩>='60')
select @qkrs=count(*) from 计算机考试成绩201112 where 院系名称='旅游系' and (理论成绩='0' and 操作成绩='0')
select str(convert(float,(@czcj/@ckrs)*100))+'%' as 机试合格率,str(convert(float,(@bscj/@ckrs)*100))+'%' as 笔试通过率,str(convert(float,(@hgrs/@ckrs)*100))+'%' as 通过率,str(convert(float,(@qkrs/@ckrs)*100))+'%' as 缺考率
展开