MySQL必知必会(使用子查询)

SELECT cust_name, cust_contact FROM customers
WHERE cust_id IN (SELECT cust_id FROM orders #单独写多个分句,最后组成一个.
                  WHERE order_num IN (SELECT order_num FROM orderitems #Where子句和Select子句中的列必须相同.
                                      WHERE prod_id = 'TNT2' )); # 还有其他方法可以替代该方法.

 

posted @ 2015-08-22 21:46  lasclocker  阅读(171)  评论(0编辑  收藏  举报