I'm using this sql statement to retrieve records from my table where the field view does not equal 1 (view is an INT field size 4)
$sql = mysql_query("select * from mytable where view !=1 order by date_written desc");
But it doesn't work - it returns no records.
I changed it to this and this works:
$sql = mysql_query("select * from mytable where view ='' OR ISNULL(view) order by date_written desc");
But I thought the first one would work - can anyone put me right as to why the first select query doesn't work?
July 10th, 2000, 01:20 AM
I tried your first statement and it worked fine for me. i'm not sure what the problem could be. what version are you using??
July 10th, 2000, 09:12 PM
In mysql, the proper "not equal to" statement is <> not !=
July 10th, 2000, 10:26 PM
Actually, either != or <> are perfectly acceptable.