题解 | #返回购买 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")