> -----Original Message-----
> From: Merlin Morgenstern [mailto:merli...@fastmail.fm]
> Sent: 07 December 2009 11:52
> To: "Sándor Tamás (HostWare Kft.)"
> Cc: Merlin Morgenstern; php-general@lists.php.net
> Subject: Re: [PHP] Re: logic operands problem
> Sándor Tamás (HostWare Kft.) wrote:
> > I don't really get it. This is a select statement working with the
> > datas of one table.
> > A field of a record (namely "page" here) can only take one value,
> so
> > it is totally nonsense to give XOR for that field.
> >
> > I think you want to select two different recordsets: one with page
> 1
> > and 3, and another with 2 and 3, am I right?
> >
> > SanTa
> >
> Yes, you are right. Any ideas on how to do this within one query?

If you need these two specific recordsets, I don't see how you can.  You'll 
have to make two queries and do any further logic in PHP using the two sets of 

XOR is a total nonsense in this situation -- as your condition is targeting a 
single, single-valued field, the value you are testing cannot possibly be 
simultaneously both 1 and 2, so the XOR operator is essentially redundant and 
effectively the same as the OR operator. This is pretty much why SQL does not 
offer you the XOR operator! All of the condition variants I've seen in this 
thread so far pretty much boil down to (page=1 OR page=2 OR page=3), which, as 
you found, returns your entire database.


Mike Ford,
Electronic Information Developer, Libraries and Learning Innovation,  
Leeds Metropolitan University, C507, Civic Quarter Campus, 
Woodhouse Lane, LEEDS,  LS1 3HE,  United Kingdom 
Email: m.f...@leedsmet.ac.uk 
Tel: +44 113 812 4730

To view the terms under which this email is distributed, please go to 

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

Reply via email to