体验新版 GitCode,发现更多精彩内容 >>
-- @author tungs1 -- @modified 2013-07-28 12:00:00 -- @created 2013-07-28 12:00:00 -- @description groupingfunction groupingfunc19.sql -- @db_name groupingfunction -- @executemode normal -- @tags groupingfunction -- order 1 SELECT SUM(sale.pn) as g1 FROM product, sale WHERE product.pn=sale.pn GROUP BY GROUPING SETS (sale.pn, product.pname) ORDER BY g1; g1 ------ 200 200 300 300 400 400 600 700 700 800 800 800 800 1000 1600 (15 rows)