RE: MySQL '!=' ???

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello.

The query is false, because if you loook what an OR do this give :

false OR false => false
true OR false => true
false OR true => true
true OR true => true

So when your request find Argentina It is false, but when it looks the next statement and check if country is different of Mexico this is true, so following the OR table, the statement is true, so it is printed.

I think you can fix this by using a NOT stament and inverting your WHERE parameters.

and changes your request to 

SELECT country
FROM reech_leed_tool
WHERE NOT(country = 'Argentina' OR country = 'Mexico' ....)

So if we got one of the country you did not want to be printed the statement within the NOT is true, so by inverting it it become false and so not printed; and if the country of the line that is checked did not have a country WITHIN the condition.

That should fix your problem, even if I'm quite sure there is a better way.

Regards,

Aurelien Vandoorine

-----Message d'origine-----
De : Hutchins, Richard [mailto:Richard.Hutchins@xxxxxxxxxxxxxx]
Envoyé : mardi 20 juillet 2004 14:20
À : php-db@xxxxxxxxxxxxx
Objet : RE:  MySQL '!=' ???


Tris,

Instead of using != in your statement, try using <>. I looked in my copy of
the MySQL Manual and it shows both != and <> for the not equal concept, but
the examples given only show the <> format used.

Not sure if it'll solve the problem, but it's the first thing I'd try.

Rich


> -----Original Message-----
> From: Tristan.Pretty@xxxxxxxxxxxxxxxx
> [mailto:Tristan.Pretty@xxxxxxxxxxxxxxxx]
> Sent: Tuesday, July 20, 2004 4:58 AM
> To: php-db@xxxxxxxxxxxxx
> Subject:  MySQL '!=' ???
> 
> 
> Hi there...
> I'm trying to select all records from a MySQL database, and 
> exclude those 
> from certain countries...
> I've posted a copy of an SQL statement I've got that I'm using in 
> PHPMyADMIN.
> And as you can see, I've said not to pick Argentina, but 
> there it is???
> What first year mistake am I making?
> 
> See image below:
> http://www.risk.sungard.com/sql.gif
> 
> Tris...
> 
> *********************************************************************
> The information contained in this e-mail message is intended only for 
> the personal and confidential use of the recipient(s) named above.  
> If the reader of this message is not the intended recipient 
> or an agent
> responsible for delivering it to the intended recipient, you 
> are hereby 
> notified that you have received this document in error and that any
> review, dissemination, distribution, or copying of this message is 
> strictly prohibited. If you have received this communication 
> in error, 
> please notify us immediately by e-mail, and delete the 
> original message.
> **************************************************************
> *********
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



=======================================================

Ce message et toutes les pieces jointes (ci-apres le "message") 
sont confidentiels et etablis a l'intention exclusive de ses destinataires.
Toute utilisation ou diffusion non autorisee est interdite. 
Tout message electronique est susceptible d'alteration. 
La SOCIETE GENERALE et ses filiales declinent toute responsabilite
au titre de ce message s'il a ete altere, deforme ou falsifie.
                               	 
=======================================================

This message and any attachments (the "message") are confidential
and intended solely for the addressees.
Any unauthorized use or dissemination is prohibited. 
E-mails are susceptible to alteration.   
Neither SOCIETE GENERALE nor any of its subsidiaries or affiliates
shall be liable for the message if altered, changed or falsified. 

=======================================================

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux