I have a single column in a table which looks like this:
(field3 is NULL. I use QTODBC7.0 to perform SQL queries, and this application makes NULL fields appear blank in the query results, rather than displaying the text 'NULL')
I have a simple SQL query as follows:
select * from table where field3 <> 'randomstring'
I expect the query to return ALL fields where field3 does not equal the value of 'randomstring'.
The column, 'field3' does not equal the value of 'randomstring' therefore, it should be returned in the query.
A strange thing happens:
The above query returns nothing!
field3 equals NULL therefore, it does not equal 'randomstring' therefore, the row should be returned in my query, but it is not.
I did some testing, and discovered, this is caused when field3 is NULL but not If field3 equals a blank string (not NULL).
How can I make the select statement work when there could be NULL values in field3?


column3 IS NULLto check for null value.<=>NULL-safe equal to operator.