MySQL A or B but NOT both
This seems like an easy query but I cannot seem to get it or relate it to other posts on stack overflow. Would anyone be able to explain... This is what I have so far, it is returning records for all bars where one or both people go. TBL frequents Schema - drinker VARCHAR(50) PK, bar VARCHAR(50) PK Bars which are frequented by John or Rebecca but not by both of them SELECT DISTINCT bar FROM frequents WHERE drinker = 'John' XOR drinker = 'Rebecca' AND bar NOT IN ( SELECT f1.bar FROM frequents f1, frequents f2 WHERE ( f1.drinker = 'John' AND f2.drinker = 'Rebecca' AND f1.bar = f2.bar ) );