select * from 表名 where content1!=0 and content2!=0

解决方案 »

  1.   

    这样也查询不出来东西啊,你想,要是content1不等于0,而content2等于0,此时语句中有:content2!=0
    的字样,就选不出来数据了啊,有没有其他的方法啊?
      

  2.   

    select * from 表名 where content1!=0 or content2!=0
      

  3.   

    select * from 表名 where content1<>0 or content2<>0
    "<>"才是不等于的意思
      

  4.   

    上面那个写错了,这个是对的select * from 表名 where content1<>0 and content2<>0
      

  5.   

    回复人: newste(旭林) ( ) 信誉:100  2004-9-23 1:38:25  得分: 0  
     
     
       
    select * from 表名 where content1<>0 or content2<>0
    "<>"才是不等于的意思
    ---------------------------<>的作用和!=是一样的,大哥  
     
      

  6.   

    content1和content2是不是varchar類型?
    如果是
    select * from 表名 where isnull(content1,'')<>'0' and isnull(content2,'')<>'0'如果是數字類型
    select * from 表名 where isnull(content1,1)<>0 and isnull(content2,1)<>0
    注意平時我們用isnull(content1,0),現在因為是與0比較﹐所以用isnull(content1,1)﹐只有這樣是空值的才能被選出來