Вот, пожалуйста,
CREATE TABLE CustomerTable(
CustomerName VARCHAR(45),
Service VARCHAR(45)
);
INSERT INTO CustomerTable VALUES
('Mark', 'House'),
('Mark', 'Condo'),
('Ashley', 'Condo'),
('John', 'House'),
('John', 'Condo'),
('David', 'House'),
('Peter', 'House'),
('Peter', 'Apartment'),
('Peter', 'Condo'),
('Amanda', 'House'),
('Amanda', 'Apartment');
SELECT CustomerName
FROM CustomerTable
WHERE Service IN ('House', 'Apartment')
GROUP BY CustomerName
HAVING MAX(Service) != MIN(Service);
Возвращает:
+----+--------------+
| | CustomerName |
+----+--------------+
| 1 | Amanda |
| 2 | Peter |
+----+--------------+