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' ) )
题目表述有点问题,描述当中“你想知道xxx的日期"跟这个题目没有关系
就是有三张表,Customer,Orders,OrderItems(可以题干最下面的表创建sql)
Customer表:
cust_id | cust_email |
cust10 | cust10@cust.com |
cust1 | cust1@cust.com |
cust2 | cust2@cust.com |
Orders表
order_num | cust_id | order_date |
a0001 | cust10 | 2022-01-01 00:00:00 |
a0002 | cust1 | 2022-01-01 00:01:00 |
a0003 | cust1 | 2022-01-02 00:00:00 |
a0013 | cust2 | 2022-01-01 00:20:00 |
OrderItems表
prod_id | order_num |
BR01 | a0001 |
BR01 | a0002 |
BR02 | a0003 |
BR02 | a0013 |