I have to extract data from a table using a query as follows
select * from table A
where A.somecoulmn NOT IN(select anothercolumn from b)
AND
(..........);
The problem I have is that, in table 'A' 50 % of the rows have Null values for column 'somecolumn'. So the above query pulls only the remaining 50 % rows.
I am using the following now
select * from table a
where
(
a.somecoulmn IS NULL OR a.somecoulmn NOT IN(select anothercolumn from b)
)
AND
(.....);
;
Though this works, it is taking a long time. Is there any other way I can achieve the above.
One more doubt. Would it be more faster if I update table A with 0 for 'somecolumn' where its value is null and use my first query.
select * from table A
where A.somecoulmn NOT IN(select anothercolumn from b)
AND
(..........);
The problem I have is that, in table 'A' 50 % of the rows have Null values for column 'somecolumn'. So the above query pulls only the remaining 50 % rows.
I am using the following now
select * from table a
where
(
a.somecoulmn IS NULL OR a.somecoulmn NOT IN(select anothercolumn from b)
)
AND
(.....);
;
Though this works, it is taking a long time. Is there any other way I can achieve the above.
One more doubt. Would it be more faster if I update table A with 0 for 'somecolumn' where its value is null and use my first query.