题解

方法一:层层嵌套
select cust_email
from Customers
where cust_id in
(
    select cust_id
    from Orders
    where order_num in
        (
            select order_num
            from OrderItems
            where prod_id = 'BR01'
        )
)
方法二:连接三表:
select Customers.cust_email
from Customers
join
Orders
on Customers.cust_id = Orders.cust_id
join
OrderItems
on Orders.order_num = OrderItems.order_num
where OrderItems.prod_id = 'BR01'



全部评论

相关推荐

点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务