Re: SQL Question - The Answers --
Posted in 1996
rickt wrote: > > **MORAL** > If you can guarantee that your column(s) do not have nulls, > then the distinct will work find, otherwise you may have to do the > more round about method with the temp table. > > Yea, that's the tricky part about NULLs. You have to remember that it is considered a non-value, an indeterminate value. They don't get counted as a group in the query because there is no way to determine what the value of NULL actually is: shall they be categorized as "not-the-A" value or "not-the-B" value, etc? The system wouldn't know how to group the NULLs, and since they would not necessarilly be the same non-value, it would be erroneous to count them as the group "NULL". I try to avoid the NULL gotchas by not having NULL columns at all. I try to create tables whose column values are all set to some default, real value. Otherwise things can get confusing, as you have seen. --Cosmo Lee