首页 > 开发 > 综合 > 正文

一条SQL语句

2024-07-21 02:06:08
字体:
来源:转载
供稿:网友
以前没见过。。。
数据库这一块这是大啊。。。

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
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表