SELECT A,B, CASE WHEN 200<=B<300 THEN '5'WHEN 100<=B<200 THEN '1'ELSE '0' END B的得分,C,CASE WHEN 200<=c<300 THEN '5'WHEN 100<=c<200 THEN '1'ELSE '0' END C的得分,FROM a; 200<=B<300 得5 c同理100<=B<200 得1 c同理
SELECT A,B, CASE WHEN 200<=B<300 THEN '5'WHEN 100<=B<200 THEN '1'ELSE '0' END B的得分,C,CASE WHEN 200<=c<300 THEN '5'WHEN 100<=c<200 THEN '1'ELSE '0' END C的得分,FROM a;
200<=B<300 得5 c同理
100<=B<200 得1 c同理
SELECT A,B,
CASE WHEN B>=200 and B<300 THEN '5'
WHEN B>=100 and B<200 THEN '1'
ELSE '0'
END
FROM
a
------SQL里面不能连写比较区间 要分开用and链接