Re: Problem with 'OR' statement

2004-01-09 Thread Michael Stassen
Your current statement, with the OR, says to select a record if its name 
is not FIND_ME or if its name is not OPEN.  That will be all of them.  I 
expect you want all of them except the ones named FIND_ME and OPEN.  So, 
you want AND instead of OR, because logically, "NOT (this OR that)" = 
"NOT this AND NOT that".  Try

  SELECT * FROM $TableName
  WHERE machinename != 'FIND_ME' AND machinename != 'OPEN'
Alternatively, you could do

  SELECT * FROM $TableName
  WHERE machinename NOT IN ('FIND_ME', 'OPEN')
Michael

Hunter, Jess wrote:

Could someone have a look at this syntax and give me some guidance what I
may be overlooking?
SELECT * from $TableName WHERE machinename != 'FIND_ME' OR machinename !=
'OPEN'
I can make the statement work individually, but when I try to  add the 'OR'
statement it fails to 'remove' the designated records from the display page.
I have tried moving the 'FIND_ME' and 'OPEN' around and still get the same
results.
Any help would be appreciated

Jess

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.558 / Virus Database: 350 - Release Date: 1/2/04
 



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: Problem with 'OR' statement

2004-01-09 Thread Matt Fuller
Jess,

You should use an AND (&&) instead of the OR. You result is everything, 
correct? When the query is doing the machinename != 'FIND_ME', the 
record(s) with machinename = 'OPEN' are being returned. Likewise, when the 
machinename != 'OPEN' is being performed, the records(s) with machinename = 
'FIND_ME' will be returned. Thus, every record is being returned. If you 
use AND the query will return your intended result, all the records where 
machinename != 'FIND_ME' AND machinename != 'OPEN'.

HTH
Matt
At 10:22 AM 1/9/2004, you wrote:
Could someone have a look at this syntax and give me some guidance what I
may be overlooking?
SELECT * from $TableName WHERE machinename != 'FIND_ME' OR machinename !=
'OPEN'
I can make the statement work individually, but when I try to  add the 'OR'
statement it fails to 'remove' the designated records from the display page.
I have tried moving the 'FIND_ME' and 'OPEN' around and still get the same
results.
Any help would be appreciated

Jess

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.558 / Virus Database: 350 - Release Date: 1/2/04
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: Problem with 'OR' statement

2004-01-09 Thread Stefan Kuhn
Am Friday 09 January 2004 17:57 schrieb Stefan Kuhn:
> Am Friday 09 January 2004 17:22 schrieb Hunter, Jess:
> > Could someone have a look at this syntax and give me some guidance what I
> > may be overlooking?
> >
> > SELECT * from $TableName WHERE machinename != 'FIND_ME' OR machinename !=
> > 'OPEN'
>
> A query like "where x=a or s=b" will always return all values. Why? Because

Sorry, should read "where x!=a or s!=b" as in your mail.
Stefan

> the value is always differen from at least a or b. So such a query is
> nonsense.
> You want all records unequal to a and b, i. e. everything except a and b?
> Use and.
> Stefan
>
> > I can make the statement work individually, but when I try to  add the
> > 'OR' statement it fails to 'remove' the designated records from the
> > display page. I have tried moving the 'FIND_ME' and 'OPEN' around and
> > still get the same results.
> >
> > Any help would be appreciated
> >
> > Jess
> >
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.558 / Virus Database: 350 - Release Date: 1/2/04

-- 
Stefan Kuhn M. A.
Cologne University BioInformatics Center (http://www.cubic.uni-koeln.de)
ZÃlpicher Str. 47, 50674 Cologne
Tel: +49(0)221-470-7428   Fax: +49 (0) 221-470-7786
My public PGP key is available at http://pgp.mit.edu


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Problem with 'OR' statement

2004-01-09 Thread Stefan Kuhn
Am Friday 09 January 2004 17:22 schrieb Hunter, Jess:
> Could someone have a look at this syntax and give me some guidance what I
> may be overlooking?
>
> SELECT * from $TableName WHERE machinename != 'FIND_ME' OR machinename !=
> 'OPEN'

Some other thing: Instead of saying "where x!=a and x!=b" you could also say 
"where !(x==a or x==b)". That's known as de Morgan's law. (sometimes the math 
course at university pays off, surprise!)
Stefan

>
> I can make the statement work individually, but when I try to  add the 'OR'
> statement it fails to 'remove' the designated records from the display
> page. I have tried moving the 'FIND_ME' and 'OPEN' around and still get the
> same results.
>
> Any help would be appreciated
>
> Jess
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.558 / Virus Database: 350 - Release Date: 1/2/04

-- 
Stefan Kuhn M. A.
Cologne University BioInformatics Center (http://www.cubic.uni-koeln.de)
ZÃlpicher Str. 47, 50674 Cologne
Tel: +49(0)221-470-7428   Fax: +49 (0) 221-470-7786
My public PGP key is available at http://pgp.mit.edu


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Problem with 'OR' statement

2004-01-09 Thread Stefan Kuhn
Am Friday 09 January 2004 17:22 schrieb Hunter, Jess:
> Could someone have a look at this syntax and give me some guidance what I
> may be overlooking?
>
> SELECT * from $TableName WHERE machinename != 'FIND_ME' OR machinename !=
> 'OPEN'

A query like "where x=a or s=b" will always return all values. Why? Because 
the value is always differen from at least a or b. So such a query is 
nonsense.
You want all records unequal to a and b, i. e. everything except a and b? Use 
and.
Stefan

>
> I can make the statement work individually, but when I try to  add the 'OR'
> statement it fails to 'remove' the designated records from the display
> page. I have tried moving the 'FIND_ME' and 'OPEN' around and still get the
> same results.
>
> Any help would be appreciated
>
> Jess
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.558 / Virus Database: 350 - Release Date: 1/2/04

-- 
Stefan Kuhn M. A.
Cologne University BioInformatics Center (http://www.cubic.uni-koeln.de)
ZÃlpicher Str. 47, 50674 Cologne
Tel: +49(0)221-470-7428   Fax: +49 (0) 221-470-7786
My public PGP key is available at http://pgp.mit.edu


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Problem with 'OR' statement

2004-01-09 Thread Hunter, Jess
Could someone have a look at this syntax and give me some guidance what I
may be overlooking?

SELECT * from $TableName WHERE machinename != 'FIND_ME' OR machinename !=
'OPEN'

I can make the statement work individually, but when I try to  add the 'OR'
statement it fails to 'remove' the designated records from the display page.
I have tried moving the 'FIND_ME' and 'OPEN' around and still get the same
results.

Any help would be appreciated

Jess

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.558 / Virus Database: 350 - Release Date: 1/2/04
 

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]