再程序里面 有这样一条sql语句
取出来的结果是
A B C D E F
3 q q q q g
1 s s s s s
2 e e e   t
5 r r r   y
7 t t t t t
9 r r r   r我现在只想在修改这个sql语句的基础上 
取出来的结果要是
A B C D E F
3 q q q q g
1 s s s s s
2 e e e   t
5 r r r   y
7 t t t t t也就是说:这样一个表  当E列的最后一个值不为空 就取从第一行到E列最后一个值不为空的那一行请问:sql语句怎么修改 或者怎么写?

解决方案 »

  1.   

    sql语句嘛  就是  select * from tabtle
              现在要改成 select * from table where 最后一行的第E列的值 is not null怎么写啊?头大...
      

  2.   

    你那t  ,y  是属于E列还是F列啊
      

  3.   

    select * from t
    where a<(select max(a) from t where e is null)
      

  4.   

    如果你不要不排序取出
    if exists(你的select语句 where e is null)
    begin 
      declare @tbl table(no int indentity(1,1),a nchar(1),b nchar(1),c nchar(1),
        d nchar(1),e nchar(1),f nchar(1)
      )
      insert into @tbl(a,b,c,d,e,f) 你的select语句  select a,b,c,d,e,f from @tbl where no <(select top 1 no from @tbl where e is null)
    end
    else
    begin
     你的select语句
    end