1

So originally my question was - 'How to prevent duplicates between two columns, using one table?' I tried to check the same query via Command Line and it returned different result. Maybe I need to change the SQL editor? What is the problem here in general and how can I fix it? Thanks in advance!

Query:

SELECT 
    c1.city,
    c1.customerName,
    c2.customerName
FROM
    customers c1
INNER JOIN
    customers c2
    ON c1.city = c2.city 
    AND c1.customerName > c2.customerName
WHERE c1.city = 'Auckland'
ORDER BY
    c1.city;

Command Line Result

PopSQL Result

Edit: fixed the tables results

nbk
  • 45,398
  • 8
  • 30
  • 47
Anton Ionov
  • 21
  • 1
  • 4

0 Answers0