RE: Re: logic operands problem

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

 



> -----Original Message-----
> From: Merlin Morgenstern [mailto:merlin_x@xxxxxxxxxxx]
> Sent: 07 December 2009 11:52
> To: "Sándor Tamás (HostWare Kft.)"
> Cc: Merlin Morgenstern; php-general@xxxxxxxxxxxxx
> Subject: Re:  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 results.

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.

Cheers!

Mike
 -- 
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.ford@xxxxxxxxxxxxxx 
Tel: +44 113 812 4730




To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux