SELECT p1.first_name, p1.last_name, p1.city, p1.height FROM patients p1 WHERE EXISTS (SELECT 1 FROM patients p2 WHERE p2.patient_id <> p1.patient_id AND p2.city = p1.city AND p2.gender = p1.gender AND p2.height = p1.height);
Write your query and click "Run Query" (Ctrl + Enter) to see results and testcase validation.