11 lines
335 B
SQL
11 lines
335 B
SQL
/*16. Write a query to find the salesmen who have multiple customers.*/
|
|
SELECT *
|
|
FROM salesman
|
|
WHERE salesman_id IN (
|
|
SELECT DISTINCT salesman_id
|
|
FROM customer a
|
|
WHERE EXISTS (
|
|
SELECT *
|
|
FROM customer b
|
|
WHERE b.salesman_id=a.salesman_id
|
|
AND b.cust_name<>a.cust_name)); |