commit c688629e2bcf1b51d04a0db85b1025c34aded5dc parent 42e51f71841bcbeeec9e562a769b414948f63391 Author: AndrewLockVI <andrewlaack1@gmail.com> Date: Tue, 18 Apr 2023 01:18:44 -0500 Completed sales person problem Diffstat:
| A | sales-person/sales-person.sql | | | 20 | ++++++++++++++++++++ |
1 file changed, 20 insertions(+), 0 deletions(-)
diff --git a/sales-person/sales-person.sql b/sales-person/sales-person.sql @@ -0,0 +1,20 @@ +--Find all sales people who do not have any experience trading with +--the "RED" customer. +--I used not in to check that the name was not in the list of names that traded with that group. +SELECT S.name +FROM SalesPerson AS S +LEFT JOIN Orders AS O +ON O.sales_id = S.sales_id +LEFT JOIN Company AS C +ON C.com_id = O.com_id +WHERE S.name NOT IN +( +SELECT S.name +FROM SalesPerson AS S +LEFT JOIN Orders AS O +ON O.sales_id = S.sales_id +LEFT JOIN Company AS C +ON C.com_id = O.com_id +WHERE C.name = "RED" +) +GROUP BY S.name