打印本文 打印本文 关闭窗口 关闭窗口
一条SQL语句
作者:武汉SEO闵涛  文章来源:敏韬网  点击数1115  更新时间:2007/11/14 12:56:42  文章录入:mintao  责任编辑:mintao
以前没见过。。。
数据库这一块这是大啊。。。

select distinct y.cid from orders x, orders y where y.pid = x.pid and x.aid = ''''a06'''';
                                      ~~~~~~~~~~~~以前没见过同一个表 两次

原来要实现的目的是:
Get cid values of customers who order a product for which an order is also placed by agent a06.
                                                                                                           ~~关键就是这个词了
ps:几个表
CUSTOMERS cid cname city discnt
PRODUCT pid pname city quantity price
AGENTS  aid aname city percent
ORDERS ordno month cid aid pid qty dollars

打印本文 打印本文 关闭窗口 关闭窗口