select * from t1 where aa>100 
這樣就默認取得最大

解决方案 »

  1.   

    select 
        * 
    from 
        t1 
    where 
        aa>all
        (select 
             aa
         from 
             t1
         where 
             aa>100 
          )
      

  2.   

    --小于啊。select 
        * 
    from 
        t1 
    where 
        aa<all
        (select 
             aa
         from 
             t1
         where 
             aa>100 
          )
      

  3.   

    你们不明我的意思,select * from t1 where aa>100 and aa<@maxtt @maxtt是个参数来的,当对应的edit1.text为空时,@maxtt参数就为最大数,如何表示数值的最大值?
      

  4.   

    declare @m int
    select @m=max(aa) from t1
    select * from t1 where aa>100 and a<@m
    Go
      

  5.   

    /*
    @maxtt是个参数来的,当对应的edit1.text为空时,@maxtt参数就为最大数,如何表示数值的最大值?
    */无法理解楼主这句话的意思啊是不是这样:
    select * from t1 where aa>100 and aa not in(select max(aa)from t1)
      

  6.   

    请参考:
      select * from t1 where aa>100 and aa<(select max(aa) from t1)