2013-05-08 60 views
0

我在Oracle中的一些數據現在我想如下 - 我要排除這些行來過濾這些數據,所有COL1,COL2,COL3,COL4是 'N'過濾數據由四列

enter image description here

我嘗試以下,這樣我可以得到列所有COL1,COL2,COL3,COL4不是 'N'

Select * from Table1 
Where (col1 != ‘N’ and col2 != ‘N’ and col3 != ‘N’ and col4 != ‘N’) 

但它不工作。 我需要在這裏包括什麼額外條件才能獲得理想的結果。

回答

1

嘗試像

Select * from Table1 
Where not (col1 = ‘N’ and col2 = ‘N’ and col3 = ‘N’ and col4 = ‘N’) 

Select * from Table1 
Where (col1 != ‘N’ or col2 != ‘N’ or col3 != ‘N’ or col4 != ‘N’) 
+0

是其工作。謝謝 !!!!混淆我怎麼沒有意識到使用OR。 – 2013-05-08 12:56:45