I have four fields -- itemnum, storeloc, binnum, and quantity.
I am trying to select data, where the first three fields match, but binnum is sometimes null. When I perform my sum on quantity, the calculation is not correct because of the NULL binnum. The database has an index where there can only be one itemnum, storeloc, and binnum combination where binnum can be NULL. I realize is it bad practice to allow a key to have NULL data, but I do not have control over how the data is structured.
I have tried the following where clauses:
where nvl(b.binnum,0) = nvl(mu.binnum,0)
where b.binnum is null and mu.binnum is null
Neither works. Any suggestions?