select * from tablename where jq>3 or jq<-3select * from tablename where jq>2 or jq<-3不知楼主是不是这个意思?

解决方案 »

  1.   

    select * from tablename
    where jq>3
    or jq<-3
      

  2.   

    select max(jq) as djq,min(jq) as xjq from tablename
      

  3.   

    select max(jq) as djq,min(jq) as xjq from tablename where jq>3 or jq<-3
    不過剛才做測試的時候發現個問題。就是往表中插值的時候,數據順序的問題。
    如下:
    create table #t(id int identity(1,1),val int)
    insert into #t
    select 1
    union
    select -1
    我本以為表中數據為
    1,1
    2,-1
    可實際是是
    1,-1
    2,1
    我怎麼樣才能得到
    1,1
    2,-1
    呢?
    望解答
      

  4.   

    插入之后再SELECT一遍
    再排序就行了
      

  5.   

    select max(abs(jq)) as djq,min(jq) as xjq from tablename order by id