where e.order-no=f.order-no) g group by cust-id having count

问题描述:

where e.order_no=f.order_no) g group by cust_id having count(distinct prod_id)>=3) h) 为什么要加h?
select a.cust_id,cust_name,b.prod_id,prod_name,d.qty,d.qty*d.unit_price
from customer a,product b,sales c,sale_item d
where a.cust_id=c.cust_id and d.prod_id=b.prod_id and
c.order_no=d.order_no and a.cust_id in (
select cust_id
from (select cust_id,count(distinct prod_id) prod_id
from (select cust_id,prod_id
from sales e,sale_item f
where e.order_no=f.order_no) g
group by cust_id
having count(distinct prod_id)>=3) h)
1个回答 分类:英语 2014-11-24

问题解答:

我来补答
简化后其实是这样的
from (
from () g
) h
h与g都叫做表别名,因为from子句后面()没有明确的表名,
需要添加表别名来让系统识别,h和g分别代表内部的select输出
 
 
展开全文阅读
剩余:2000
下一页:铜,及其化合物