On the move:

I'm currently moving the following to their own blogs: Unix, HTML for Blogs, Perl & Java.
The links are on the left side.

Saturday, May 31, 2008

NVL For Correct Counts

If you're matching on fields that have any possibility of being null, make sure you code them with the NVL function. If you don't, your count will not be correct.
Select Count(*)
From Client B
Join Account A
On a.Code = b.Retail_Num
Where Nvl(a.Name ,' ') = Nvl(b.Client_Name ,' ')
And Nvl(a.State,' ') = Nvl(b.Client_State,' ')
And Nvl(a.Zip ,' ') = Nvl(b.Client_Zip ,' ');

No comments:

Post a Comment