Using exclusive or in mysql
Yes, XOR. MySQL XOR operator checks two operands (or expressions) and returns TRUE if one or the other but not both is TRUE.
select * from foobar
where foo = 1 XOR bar = 1
The actual mathematical representation of a XOR equation "A XOR B
" is "(A AND (NOT B)) OR ((NOT A) AND B)
".
try like this:
select * from test where foo = 1 XOR bar = 1;
Sql Fiddle: http://sqlfiddle.com/#!2/079cc/4