Can Anyone Give Me The Example Of Self Join ?

Forums SQLCan Anyone Give Me The Example Of Self Join ?
Staff asked 2 years ago

Answers (1)

Add Answer
Umang Ramani Marked As Accepted
Staff answered 2 years ago
SELECT A.customername AS CustomerName1,
       B.customername AS CustomerName2,
       A.city
FROM   customers A,
       customers B
WHERE  A.customerid <> B.customerid
       AND A.city = B.city
ORDER  BY A.city;

 

Subscribe

Select Categories