有一张table-t表,里面有三个字段:语文,数学,英语,其中有三条记录分别表示语文70分,数学80分,英语58

,请用一条sql语句查询出这三条记录并按以下条件显示出来:
大于或等于80表优秀,大于等于60表及格,小于60表不及格显示格式:
语文 数学 英语
及格 优秀 不及格

select case when 语文>=80 then '优秀' when 语文>=60 then '及格' else '不及格' end 语文 ,
case when 数学>=80 then '优秀' when 数学>=60 then '及格' else '不及格' end 数学 ,
case when 英语>=80 then '优秀' when 英语>=60 then '及格' else '不及格' end 英语 from table_t
温馨提示:答案为网友推荐,仅供参考
第1个回答  2012-07-16
select case 语文 when(语文>=80) then '优秀' else when(语文>60) then '及格' else '不及格'……
相似回答