三种方法
确定哪些订单购买了 prod_id 为 BR01 的产品(二)
http://www.nowcoder.com/practice/999aa31a9a504c60baa088d90d82e64d
#方法一
select cust_id, order_date
from Orders,
(select order_num
from OrderItems
where prod_id="BR01") t
where t.order_num = Orders.order_num
order by order_date;
#方法二
select cust_id,order_date
from Orders
where order_num in
(select order_num
from OrderItems
where prod_id="BR01")
order by order_date;
#方法三
select cust_id,order_date
from Orders o join OrderItems oi on o.order_num=oi.order_num
where prod_id="BR01"
order by order_date;