一条SQL语句

以前没见过。。。
数据库这一块这是大啊。。。

select distinct y.cid from orders x, orders y where y.pid = x.pid and x.aid = 'a06';

1  
2原来要实现的目的是:   
3Get cid values of customers who order a product for which an order is also placed by agent a06.   
4~~关键就是这个词了   
5ps:几个表   
6CUSTOMERS cid cname city discnt   
7PRODUCT pid pname city quantity price   
8AGENTS aid aname city percent   
9ORDERS ordno month cid aid pid qty dollars
Published At
Categories with 数据库类
Tagged with
comments powered by Disqus