p; end
select * from newtable
select 姓名 = stuname,学号 = stuno,笔试成绩 = case
when writtenexam is null then ''缺考''
else convert(varchar(5),writtenexam)
end
,机试成绩 = case
when labexam is null then ''缺考''
else convert(varchar(5),labexam)
end
,是否通过 = case
when ispass = 1 then ''是''
else ''否''
end
from newtable
select 总人数 = count(*),通过人数 = sum(ispass)
通过率 = (convert(varchar(5),avg(ispass*100)) + ''%'') from newtable
author: k&j
QQ:403455281
13:08 2007-4-23