题解 | #哪些订单购买了prod_id为BR01的产品#
确定哪些订单购买了 prod_id 为 BR01 的产品(一)
https://www.nowcoder.com/practice/b692b0174c0444fa9452aee2d082fbbb
当查询需要使用子查询时,按照由内到外的思路逐步解答:
select cust_id,order_date from Orders where order_num in (select order_num from OrderItems // 使用子查询查找产品id为"BR01"的订单编号 where prod_id = "BR01") order by order_date asc // 按照订单时间升序排列