[thelist] Simple SQL Question

r937 at interlog.com r937 at interlog.com
Wed Feb 6 19:29:00 CST 2002


> Can I select only fields that are not empty?

hi ken

yes

> I tried
>        SELECT columnName FROM tableName WHERE columnName <> ""
> but no luck.

in this instance, you will get all rows where columnName is not equal to a zero-
length string

that's *not* (i'm sorry to say) the same thing as rows where columnName is null

does your columnName allow nulls? if so, you could try

     SELECT columnName FROM tableName
              WHERE columnName IS NOT NULL

then, if necessary, you could also add

                 AND columnName <> ""

i realize the distinction is tricky to understand, so please holler if you don't see the
difference


rudy









---------------------------------------------





More information about the thelist mailing list