题解 | #返回每个顾客不同订单的总金额#

返回每个顾客不同订单的总金额

http://www.nowcoder.com/practice/ce313253a81c4947b20e801cd4da7894

对于初学者有点逆天 1.表.列名 列名,酱紫写第一次见到 2.应该是o表和tb表,其中tb表是自己定义出来的,表 别名,表 别名,不用as 的吗 3.wehere的时候为什么不用“表.列名 列名 = 表.列名 列名”了只需要“表.列名 = 表.列名”?

    o.cust_id cust_id,
    tb.total_ordered total_ordered
from(
    select 
        order_num,
        sum(item_price * quantity) as total_ordered
    from 
        OrderItems
    Group by 
        order_num
    )tb,
    Orders o
where tb.order_num = o.order_num
order by total_ordered DESC;
全部评论

相关推荐

在debug的柠檬精很迷人:好消息:现在HR挑三拣四 15年后 HR跪着求要简历 坏消息:被挑的是这代人,到时候求人的也是这代人。真好。
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务