题解 | #返回购买 prod_id 为 BR01 的产品的所有顾客的电子邮件(二)#

返回购买 prod_id 为 BR01 的产品的所有顾客的电子邮件(二)

http://www.nowcoder.com/practice/c7aa73afc41f4dfc925baebdd175c345

SQL40 返回购买 prod_id 为 BR01 的产品的所有顾客的电子邮件(二)

利用inner join将Orders和OrderItems联表,然后通过子查询定位出prod_id等于BR01的顾客邮箱

select cust_email
from Customers
where cust_id in 
(select cust_id from Orders inner join OrderItems using(order_num) 
where prod_id="BR01")
全部评论

相关推荐

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

创作者周榜

更多
牛客网
牛客企业服务