You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

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));