子查询
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 prod_id = 'TNT2'))

注意事项
使用子查询注意列必须匹配
即
select和where中的列数量一致
计算字段使用子查询
SELECT `cust_name` ,cust_state ,(SELECT COUNT(*) FROM orders WHERE orders.`cust_id`= `customers`.`cust_id`) AS orders
FROM `customers`
ORDER BY cust_name

相关子查询
就是子查询会涉及外部的查询
相关子查询必须要用选限定列名
