XOR Logical Operator - Select by Attributes

1009
1
01-17-2012 08:52 AM
Status: Open
SteveFloyd
New Contributor II
Is it possible to add the logical operator XOR to the Select By Attributes operators?  

For example, I may want to select street centerlines with a particular attribute on the left or right side, but I do not want the records where that attribute is on both sides.  It is possible to construct a selection query that functions as an XOR selection, and the following string shows how we select the Left XOR Right VTD (voting tabulation district) of a centerline.

(L_VTD = '127' AND R_VTD <> '127') OR ( L_VTD <>  '127' AND R_VTD = '127')

It would be so much less cumbersome to have a native operator for an XOR selection.
Thank you.

1 Comment
curtvprice

Let me generalize your expression

# A XOR B
(A AND NOT(B)) OR (NOT(A) AND B)‍‍‍
# this should work too with one less NOT
(A OR B) AND (NOT (A AND B))