# 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?

```
----- Original Message ----- From: "Ashley Sheridan" <a...@ashleysheridan.co.uk>
```To: "Merlin Morgenstern" <merli...@fastmail.fm>
Cc: "Peter Ford" <p...@justcroft.com>; <php-general@lists.php.net>
Sent: Monday, December 07, 2009 12:39 PM
Subject: Re: [PHP] Re: logic operands problem

```
```On Mon, 2009-12-07 at 12:37 +0100, Merlin Morgenstern wrote:

```
```Peter Ford wrote:
> Merlin Morgenstern wrote:
>> Hello everybody,
>>
>> I am having trouble finding a logic for following problem:
>>
>> Should be true if:
```
>> page = 1 OR page = 3, but it should also be true if page = 2 OR page = >> 3
```>>
>> The result should never contain 1 AND 2 in the same time.
>>
>> This obviously does not work:
>> (page = 1 OR page = 3) OR (page = 2 OR page = 3)
>>
>> This also does not work:
```
>> (page = 1 OR page = 3 AND page != 2) OR (page = 2 OR page = 3 AND page
```>> != 1)
>>
>> Has somebody an idea how to solve this?
>>
>> Thank you in advance for any help!
>>
>> Merlin
>
>
> Surely what you need is xor (exclusive-or)
> I can't believe a programmer has never heard of that!
>
> (page==1 XOR page==2) AND page==3
>

HEllo Peter,

not know how to use it properly OR it is not aplicable on SQL. I am
trying to retrive data:
SELECT * FROM test WHERE ((page = 1 XOR page = 2) OR page = 3)

I know this is not php, but I thought the logic should be the same in
this case?!

Regards, Merlin

```
```

This will likely retrieve all the records in the table. Is that what
```