Find pairs of customers who live in the same city. Return the first customer's name, the second customer's name, and the city. Avoid duplicate pairs (if A-B is shown, don't also show B-A) and don't pair a customer with themselves. Sort by city, then first customer's last name.
Schema
🔑idINT
first_nameTEXT
last_nameTEXT
emailTEXT
phoneTEXTNULL
cityTEXT
stateTEXT
countryTEXT
created_atTIMESTAMP
postgresql
Run your query to see results
Press Ctrl + Enter to execute