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' )); # 还有其他方法可以替代该方法.
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' )); # 还有其他方法可以替代该方法.