我想查询平均成绩大于60的学生ID和平均成绩
select StID,avg(Score)as AvgScore from niu_SC
group by StID
having avg(Score)>60
查询结果如上图, 有6位小数, 怎么只显示2位小数呢? 在SQL语句中怎么写?
问题补充:Score是decimal类型
最佳答案:
以下为引用的内容: Create table Testtable2(ID int identity(1,1),score float,)goinsert into Testtable2(score)select 86.1union allselect 75.1union allselect 69.4select avg(score) as avescore,cast(avg(score) as decimal(10,2)) as ExactAveScore from Testtable2 |
avescore ExactAveScore
76.8666666666667 76.87
上一篇 从草根站长到建站高手的路线