leetcode-607. 销售员

607. 销售员 - 力扣(Leetcode)

这个有点像是写离线查询了

# Write your MySQL query statement below

select sp.name from (
    select sales_id, name from 
    SalesPerson
) sp left outer join (
    select sales_id, com_id
    from Orders
) o on (o.sales_id = sp.sales_id) left outer join (
    select com_id, name
    from Company
    where name = 'RED'
) c on (o.com_id = c.com_id)

group by sp.name
having count(c.com_id) <= 0
posted @ 2023-01-02 14:54  吴丹阳-V  阅读(23)  评论(0编辑  收藏  举报