question

GOT avatar image
GOT asked

How do I sort out empty data cells in a table?

In a query, how do I sort out the cells which are entered just by using spaces instead of any text?
datanullquery-planempty-string
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Grant Fritchey avatar image
Grant Fritchey answered
If someone enters a space, you can search for it in a WHERE clause using ' ' like this: ...WHERE a.ColX = ' '; But if someone enters more than one space, this won't return. Unfortunately, then, you're going to have to use some type of function on the column that's likely to result in a scan. Or, by empty are you referring to the columns that are NULL? Then you can use IS NULL or IS NOT NULL in the WHERE clause: ...WHERE a.ColX IS NOT NULL; That would return all the places where there were values in the column.
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.