有如下表:
id socre1 score2 等级
1 13 50 小兵
2 51 100 排长
3 101 200 连长
6 201 500 营长
8 501 1000 团长
10 1001 1800 旅长
11 1801 2800 师长
12 2801 5000 军长
16 5001 10000 司令要求查询600分的等级是什么
id socre1 score2 等级
1 13 50 小兵
2 51 100 排长
3 101 200 连长
6 201 500 营长
8 501 1000 团长
10 1001 1800 旅长
11 1801 2800 师长
12 2801 5000 军长
16 5001 10000 司令要求查询600分的等级是什么
if object_id('[tb]') is not null drop table [tb]
create table [tb] (id int,score1 int,score2 int,等级 varchar(4))
insert into [tb]
select 1,13,50,'小兵' union all
select 2,51,100,'排长' union all
select 3,101,200,'连长' union all
select 6,201,500,'营长' union all
select 8,501,1000,'团长' union all
select 10,1001,1800,'旅长' union all
select 11,1801,2800,'师长' union all
select 12,2801,5000,'军长' union all
select 16,5001,10000,'司令'
godeclare @score int
set @score=600
select * from [tb] where @score between score1 and score2