Hi! Could we please enable some services and cookies to improve your experience and our website?

SQLize | PHPize | SQLtest

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

A A A
Login    Share code      Blog   FAQ
Copy Format Clear
SELECT c1.customer_id, c1.first_name, c1.last_name, c2.customer_id, c2.first_name, c2.last_name FROM customer c1 LEFT JOIN customer c2 ON c1.customer_id = c2.customer_id UNION SELECT c1.customer_id, c1.first_name, c1.last_name, c2.customer_id, c2.first_name, c2.last_name FROM customer c1 RIGHT JOIN customer c2 ON c1.customer_id = c2.customer_id WHERE c1.customer_id IS NULL AND c1.first_name = c2.last_name ORDER BY c.1customer_id

Stuck with a problem? Got Error? Ask AI support!

Copy Clear