Search Postgresql Archives

Re: exclusive OR possible within a where clause?

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

 





On 10/17/11 1:19 PM, John R Pierce wrote:
On 10/17/11 12:15 PM, David Salisbury wrote:
<> is the same as !=, which is
different than the fabled XOR I was hoping for. In fact
they would never equal.

F != F -> false
F != T -> true
T != F -> true
T != T -> false


how is that different than XOR, assuming the arguments are booleans ?



Perhaps what I'm hoping to do got munged.  In essence it's equivalent of..

create table test ( something numeric );
insert into test values ( 1 );
insert into test values ( 2 );

select * from test where ( something = 1.5 + .5 ) or ( something = 1.5 - .5 );
 something
-----------
         1
         2
(2 rows)


select * from test where ( something = 1.5 + .5 ) <> ( something = 1.5 - .5 );
 something
-----------
         1
         2
(2 rows)

( which is of course equivalent of where something = 1 or something = 2 )


In my fabled XOR, I'd get the first one it matched, say something = 1, and the
something = 2 would then be ignored/dropped.

Dave





--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux