Mysql query won't work with a null column
06:55 17 Aug 2012

I'm doing a relatively simple mysql query:

         SELECT g.id FROM myTable g
            WHERE g.timestamp > '0' 
            AND g.userId = '1'
            AND g.foo != '34'
            ORDER BY g.id DESC LIMIT 0, 10

This query returns 0 rows, however if I remove the last condition, i.e change it to:

         SELECT g.id FROM myTable g
            WHERE g.timestamp > '0' 
            AND g.userId = '1'
            ORDER BY g.id DESC LIMIT 0, 10

That returns 5-6 rows. This is very strange to me, since in all of those rows, the int column foo is set to NULL

What am I doing wrong?

mysql sql database null