--测试环境 SQL2000,建立测试数据,#games 为SQL2000的临时表名称
create table #games(NickName varchar(12),One_Best_Time numeric(5,2),Two_Best_Time numeric(5,2))
insert into #games(NickName,One_Best_Time,Two_Best_Time) values('张1',20.12,24.21)
insert into #games(NickName,One_Best_Time,Two_Best_Time) values('张2',10.22,20.12)
insert into #games(NickName,One_Best_Time,Two_Best_Time) values('张3',21.22,20.12)
insert into #games(NickName,One_Best_Time,Two_Best_Time) values('张4',13.22,22.12)
insert into #games(NickName,One_Best_Time,Two_Best_Time) values('张5',14.21,42.12)
insert into #games(NickName,One_Best_Time,Two_Best_Time) values('张6',15.22,12.12)
insert into #games(NickName,One_Best_Time,Two_Best_Time) values('张7',16.24,22.12)
insert into #games(NickName,One_Best_Time,Two_Best_Time) values('张8',17.52,24.12)
insert into #games(NickName,One_Best_Time,Two_Best_Time) values('张9',18.62,12.12)
insert into #games(NickName,One_Best_Time,Two_Best_Time) values('李1',21.22,0.0)
insert into #games(NickName,One_Best_Time,Two_Best_Time) values('李2',11.32,0.0)
insert into #games(NickName,One_Best_Time,Two_Best_Time) values('李3',21.42,0.0)
insert into #games(NickName,One_Best_Time,Two_Best_Time) values('李4',41.65,0.0)
insert into #games(NickName,One_Best_Time,Two_Best_Time) values('王1',0.0,0.0)
insert into #games(NickName,One_Best_Time,Two_Best_Time) values('王2',0.0,0.0)
insert into #games(NickName,One_Best_Time,Two_Best_Time) values('王3',0.0,0.0)
insert into #games(NickName,One_Best_Time,Two_Best_Time) values('王4',0.0,0.0)
--借1个字段来完成排续,没完成的默认完成最大时间为 999.99
select *,(one_best_time + two_best_time)id from #games where one_best_time>0 and two_best_time>0
union all
select *,(one_best_time + 999.99)id from #games where one_best_time>0 and two_best_time<=0
union all
select *,(999.99 + 999.99)id from #games where one_best_time<=0 and two_best_time<=0
order by id
图片附件: 游客没有浏览图片的权限,请
登录 或
注册