Simple Solution: Left Join and in subquery beats 92%


  • 0
    C

    select distinct name from
    salesperson where name not in
    (select distinct k.name from
    (select o.com_id,s.name
    from salesperson s
    left join
    orders o
    on s.sales_id = o.sales_id)k
    where k.com_id in(select distinct com_id from company where name='RED'))


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.