寫錯了一點,應該是
如果 V1 < 60         则 L1 = "E"

解决方案 »

  1.   

    我不會case呀,誰能教我寫完整的~
      

  2.   

    create table cjb
    (v1 float,L1 char(1),v2 float ,L2  char(1))
    go
    insert into cjb(v1) select 70
    union select 90
    union select 45
    union select 86
    union select 98
    union select 77
    union select 65update cjb set L1=(case  when  v1>=90 and V1 <100 then 'A' 
    when v1 >= 80 and V1 < 90   then 'B' 
    when  v1>=70 and V1 < 80   then 'C'
    when v1>=60 and V1 < 70   then  'D'
    when   V1 <60 then 'E'         
    else 'f' end)update cjb set v2=(case when v1>=95 then 100 else v1+5 end)update cjb set L2=(case  when  v2>=90 and V2 <100 then 'A' 
    when v2 >= 80 and V2 < 90   then 'B' 
    when  v2>=70 and V2 < 80   then 'C'
    when v2>=60 and V2 < 70   then  'D'
    when   V2 <60 then 'E'         
    else 'f' end)
    select * from cjb
    v1                    L1   v2                 L2   
    45.                   E    50.                 E
    65.0                  D    70.0                C
    70.0                  C    75.0                C
    77.0                  C    82.0                B
    86.0                  B    91.0                A
    90.0                  A    95.0                A
    98.0                  A    100.0               f
      

  3.   

    把上面的改成:<100 为:<=100
    update cjb set L2=(case  when  v2>=90 and V2 <=100 then 'A'