表如下所示:
create table #rankme (rankmeid int identity(1000, 1) primary key,
step int null, checkvalue int null)
insert into #rankme values ( 10 , 1 )
insert into #rankme values ( 15 , null )
insert into #rankme values ( 20 , null )
insert into #rankme values ( 40 , null )
select * from #rankme order by step,checkvalue
作为step
一个参数,我试图找出在我请求checkvalue
之前的step
请求是否为空。
所以我想选择where step=20
并得到NULL
.
我想选择where step=15
并获得一个1
.
我试图想出一些基于“rank-1”的东西,但到目前为止还没有雪茄。
帮助?