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