Simple question: what is the syntax for an SQL statement that grabs rows that are not null in a certain column? Here is what I am trying but getting syntax errors:
$sql = "SELECT * FROM px_items WHERE read <> NULL";
$sql = "SELECT * FROM px_items WHERE read NOT NULL";
however mysql often uses an empty field for a null value so you may want this instead
$sql = "SELECT * FROM px_items WHERE read NOT NULL" && read != '';
I tried that ourt and am still getting syntax errors back from MySQL. Any other ideas?
SELECT * FROM px_items WHERE read IS NOT NULL AND read <> ''
SQL SPEC says:
AND for and, not && OR for or, not || <> for not equal, not !=
Unfortunately, MySQL chooses to use && for AND, and || for OR. Not sure it supports != for <> though.