(mssql2005)求实现类似这样的查询(红字处).select * from T
  where Condition <> "0" or Condition is not null求高手指点,谢谢。

解决方案 »

  1.   

    select * from T 
      where isnull(Condition,0) <> 0
      

  2.   

    题目补充:
      即where中包含两个判断,定义先查询Condition is not null的数据,
       然后接着在以条件Condition <> 0刷出查询数据。谢谢
      

  3.   

    where Condition <> "0" or Condition is not null 
    這個是有問題的,0到底是字符還是數字?
    字符就應該單引號,數字就應該不要引號。
    而且我認爲你應該用 AND 而不是 OR ,即既不是NULL也不為0。
    假如是數字:
    WHERE ISNULL(Condition ,0) <> 0
    假如是字符:
    WHERE ISNULL(Condition ,'0') <> '0'