Another way to approach this is if you have a rowID column in your table , you can derive one into a temp table from the base table if you don't, then use that to make the query condition into an AND condition as follows
CREATE TABLE #Null_Table(
Rowid int identity,
[CID] [int] NULL,
[MID] [int] NULL
)
--Insert Sample Data
insert into #Null_Table(CID,MID)
valueS (123,456)
GO
insert into #Null_Table(CID,MID)
valueS (123,Null)
GO
insert into #Null_Table(CID,MID)
valueS (123,0)
GO
insert into #Null_Table(CID,MID)
valueS (NULL,NULL)
GO
SELECT *
FROM #Null_Table
WHERErowID not in
(Select rowID
from #null_table
Where cid is null and
mid is null
)
drop table #null_table
I think this appears more readable if you are not used to dealing with the OR condition.
----------------------------------------------------