标签:
1.子查询
select cust_id from orders
where order_num in (select order_num from orderitems
where prod_id=‘TNT2‘)
SELECT cust_id,cust_name,(select count(*) from orders where orders.cust_id=
customers.cust_id) from customers;
等效于select q.cust_id,q.cust_name ,count(order_num) from orders p right join customers q
on p.cust_id=q.cust_id group by q.cust_id
2.等值连接(内部连接)
标签:
原文地址:http://www.cnblogs.com/Citizen/p/4718512.html