mySQL says this is wrong:
SELECT * FROM homes WHERE !`home_geo`=''
So how can I ask for cells when a value is NOT equal to a value?
like in php I can do
if (!$var==2)
{
}
mySQL NOT/ not equal to?
Moderator: General Moderators
Re: mySQL NOT/ not equal to?
it would be != (and you should do the same in PHP, which is more readable in my opinion)
http://dev.mysql.com/doc/refman/5.0/en/ ... ators.html
http://dev.mysql.com/doc/refman/5.0/en/ ... ators.html
Re: mySQL NOT/ not equal to?
<> is the same, but it conforms to the SQL standard.
MySQL 5.1: supports both != and <>
PostgreSQL 8.3: supports both != and <>
SQLite: supports both != and <>
Oracle 10g: supports both != and <>
Microsoft SQL Server 2000/2005/2008: supports both != and <>
IBM DB2 UDB 9.5: supports only <>
IBM Informix Dynamic Server 10: supports both != and <>
InterBase/Firebird: supports both != and <>
Apache Derby: supports only <>
There are 10 types of people in this world, those who understand binary and those who don't
Re: mySQL NOT/ not equal to?
pytrin++ about the PHP part:
should be
1. true if $var IS integer (or numeric data type) and its value is not 2
2. true if $var IS NOT integer
or
true if $var value is not 2 (doesn't matter whether it's string or numeric data type)
You see, when I encounter I start to wonder which operand has higher precedence - the ! or the ==. is very different from , right ?
And in the form it's crystal clear.
Code: Select all
if (!$var==2)Code: Select all
if ($var!==2)2. true if $var IS NOT integer
or
Code: Select all
if ($var!=2)You see, when I encounter
Code: Select all
if (!$var==2)Code: Select all
if ((!$var)==2)Code: Select all
if (!($var==2))And in the
Code: Select all
if ($var!=2)There are 10 types of people in this world, those who understand binary and those who don't
Re: mySQL NOT/ not equal to?
Thanks people it works.