programming-examples/sql/Joins/Write a SQL statement to find the list of customers who appointed a salesman for their jobs who does not live in the same city where their customer lives, and gets a commission is above 12%.sql
2019-11-18 14:05:53 +01:00

9 lines
425 B
SQL

/*Write a SQL statement to find the list of customers who appointed a salesman for their jobs who does not live in the same
city where their customer lives, and gets a commission is above 12%.*/
SELECT a.cust_name AS "Customer Name",
a.city, b.name AS "Salesman", b.city,b.commission
FROM customer a
INNER JOIN salesman b
ON a.salesman_id=b.salesman_id
WHERE b.commission>.12
AND a.city<>b.city;