表test1 只有字段core
core
1
10
40
59
60
79
90
100
大于等于60分的pass,小于60分fail,写SQL语句输出一些信息:
core
1 fail
10 fail
40 fail
59 fail
60 pass
79 pass
90 pass
100 pass
core
1
10
40
59
60
79
90
100
大于等于60分的pass,小于60分fail,写SQL语句输出一些信息:
core
1 fail
10 fail
40 fail
59 fail
60 pass
79 pass
90 pass
100 pass
select core, (case where core<60 then 'fail' when core>=60 and core<=100
then 'pass' end)
from test1
from tbselect core,case when core>=60 then 'pass' else 'fail' end
from tb
--修正下
select core,decode(sign(core-60),1,'pass',0,'pass',-1,'fail')
from tbselect core,case when core>=60 then 'pass' else 'fail' end
from tb
select core,decode(sign(core-60),-1,'fail','pass')
from tb
from tb
case when core>=60 then 'pass'
when core<60 then 'fail'
end as
from test1
简单些啊~哈哈
insert into S
select 1 union all
select 10 union all
select 40 union all
select 59 union all
select 60 union all
select 79 union all
select 90 union all
select 100select core,(case when core<60 then 'fail' when core>=60 then 'pass' end) as
from S