10 lines
339 B
MySQL
10 lines
339 B
MySQL
|
/*17. Write a query to find all the salesmen who worked for only one customer.*/
|
||
|
SELECT *
|
||
|
FROM salesman
|
||
|
WHERE salesman_id IN (
|
||
|
SELECT DISTINCT salesman_id
|
||
|
FROM customer a
|
||
|
WHERE NOT EXISTS (
|
||
|
SELECT * FROM customer b
|
||
|
WHERE a.salesman_id=b.salesman_id
|
||
|
AND a.cust_name<>b.cust_name));
|