zoukankan      html  css  js  c++  java
  • with rollup with cube

    Create table Inventory(Item char(10),spec char(10),sprice decimal)

    insert into Inventory values ('DVD','步步高',2000)
    insert into Inventory values ('PC','LG',3000)
    insert into Inventory values ('PC','TCL',2000)
    insert into Inventory values ('PC','三星',2000)

    --ROLLUP是按照group by后的字段依次汇总,
    --
    cube是对GROUP BY 后的所有列都汇总

    SELECT Item, spec,sum(sprice)
    from Inventory
    group by Item,spec
    with rollup


    SELECT Item, spec,sum(sprice)
    from Inventory
    group by Item,spec
    with cube
  • 相关阅读:
    实验四
    实验三
    实验二
    实验一
    6
    5
    4
    3
    shiyan2
    实验1
  • 原文地址:https://www.cnblogs.com/Snowfun/p/2277075.html
Copyright © 2011-2022 走看看