题解 | #返回每个顾客不同订单的总金额#
从 Products 表中检索所有的产品名称以及对应的销售总数
http://www.nowcoder.com/practice/2b289b78de1546f38fd24e17e56f1bec
o.表上有的列名 列名 , tb.表上没的列名 列名
from 新表 as tb, 老表 as o
where 新表.连接列 = 老表.连接列
其中新表的构成:
要select 新列名, 连接列名
from其它老表
group by 连接表名
from (
select prod_id,
sum(quantity) as quant_sold
from OrderItems
group by prod_id
) as tb1,Products as o
where o.prod_id = tb1.prod_id;