less than 1 minute read

Problem

problem-607

Query

SELECT s.name
FROM 
    SalesPerson AS s
WHERE
    s.sales_id NOT IN (
        SELECT 
            o.sales_id
        FROM
            Orders AS o
        JOIN
            Company AS c
            ON o.com_id = c.com_id AND c.name = 'RED'
    )

Editorial Solution

SELECT
    s.name
FROM
    salesperson s
WHERE
    s.sales_id NOT IN (SELECT
            o.sales_id
        FROM
            orders o
                LEFT JOIN
            company c ON o.com_id = c.com_id
        WHERE
            c.name = 'RED')
;

Tags:

Updated: