{"id":494,"date":"2021-10-08T21:20:43","date_gmt":"2021-10-08T13:20:43","guid":{"rendered":"https:\/\/www.dataisfun.cn\/?p=494"},"modified":"2021-10-10T20:58:36","modified_gmt":"2021-10-10T12:58:36","slug":"group-by%e6%b7%bb%e5%8a%a0%e6%b1%87%e6%80%bb%e8%a1%8c","status":"publish","type":"post","link":"https:\/\/www.dataisfun.cn\/?p=494","title":{"rendered":"Presto SQL-\u7ed9group by\u6dfb\u52a0\u6c47\u603b\u884c"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\" style=\"font-size:12px\">\u719f\u6089Excel\u6570\u636e\u900f\u89c6\u8868\u7684\u540c\u5b66\u90fd\u77e5\u9053\uff0cExcel\u6570\u636e\u900f\u89c6\u8868\u53ef\u9009\u62e9\u663e\u793a\u5206\u7c7b\u6c47\u603b\uff0c\u5982\u4e0b\u56fe\u6240\u793a\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/10\/\u7ed9group-by\u6dfb\u52a0\u6c47\u603b\u884c1.png\" alt=\"\" class=\"wp-image-541\" width=\"327\" height=\"446\" srcset=\"https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/10\/\u7ed9group-by\u6dfb\u52a0\u6c47\u603b\u884c1.png 653w, https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/10\/\u7ed9group-by\u6dfb\u52a0\u6c47\u603b\u884c1-220x300.png 220w\" sizes=\"auto, (max-width: 327px) 100vw, 327px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"font-size:12px\">\u4e00\u4e9b\u56fa\u5316\u7684\u8868\u683c\u578b\u62a5\u8868\u53ef\u80fd\u9700\u8981\u6709\u6c47\u603b\u884c\uff0c\u4ee5\u4fbf\u76f4\u63a5\u4f7f\u7528\u800c\u4e0d\u9700\u8981\u518d\u5728Excel\u4e2d\u52a0\u5de5\u8c03\u6574\u3002\u4e00\u4e9b\u62a5\u544a\u7528\u7684\u6570\u636e\u53ef\u80fd\u65e2\u9700\u8981\u5206\u7c7b\u6570\u636e\u4e5f\u9700\u8981\u6c47\u603b\u6570\u636e\uff0c\u5982\u679c\u80fd\u4e00\u6b21\u6027\u52a0\u5de5\u51fa\u6765\uff0c\u6548\u7387\u81ea\u7136\u66f4\u9ad8\u3002\u90a3SQL\u5982\u4f55\u5b9e\u73b0\u6b64\u7c7b\u9700\u6c42\u5462\uff0c\u6700\u539f\u59cb\u7684\u65b9\u6cd5\u662f\u5206\u522bgroup by\u540e\u7528union all\u5408\u5e76\uff0c\u8fd9\u79cd\u65b9\u5f0f\u4ee3\u7801\u4f1a\u6bd4\u8f83\u957f\u4e14\u5bb9\u6613\u51fa\u9519\uff0c\u597d\u5728Presto SQL\u76f4\u63a5\u4e3agroup by\u63d0\u4f9b\u4e863\u79cd\u652f\u6301\u590d\u6742\u5206\u7ec4\u64cd\u4f5c\u7684\u8bed\u6cd5\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\" style=\"font-size:12px\"><li><strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">grouping sets\uff1a<\/span><\/strong>\u624b\u52a8\u6307\u5b9a\u591a\u4e2a\u5206\u7ec4\u65b9\u5f0f\u3002<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\" style=\"font-size:12px\"><li><strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">cube\uff1a<\/span><\/strong>\u81ea\u52a8\u4e3a\u7ed9\u5b9a\u7684\u5b57\u6bb5\u751f\u6210\u6240\u6709\u53ef\u80fd\u7684\u5206\u7ec4\u96c6\uff0c\u65e0\u9700\u6309\u7167grouping sets\u8fdb\u884c\u4e00\u4e00\u6307\u5b9a\u3002\u6307\u5b9an\u4e2a\u5b57\u6bb5\uff0c\u5c31\u4f1a\u67092<sup>n<\/sup>\u4e2a\u5206\u7ec4\u65b9\u5f0f\u3002<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\" style=\"font-size:12px\"><li><strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">rollup\uff1a<\/span><\/strong>\u5bf9\u4e8e1\u4e2a\u6307\u5b9a\u7684\u5b57\u6bb5\uff0c\u81ea\u52a8\u4e3a\u8be5\u5b57\u6bb5\u751f\u6210\u6240\u6709\u53ef\u80fd\u7684\u5b50\u5206\u7ec4\u96c6\u3002<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"font-size:12px\">\u6ce8\u610f\uff0c\u4ee5\u4e0a3\u79cd\u8bed\u6cd5\u5728\u6307\u5b9a\u5b57\u6bb5\u65f6\uff0c\u53ea\u652f\u6301\u8868\u4e2d\u5df2\u5b58\u5728\u7684\u5b57\u6bb5\uff0c\u4e0d\u652f\u6301\u8868\u8fbe\u5f0f\u65b0\u751f\u6210\u7684\u5b57\u6bb5\uff0c\u5982\u679c\u9700\u8981\u65b0\u5b57\u6bb5\uff0c\u8981\u5148\u5efa\u4e34\u65f6\u8868\u5e76\u751f\u6210\u6240\u8981\u7528\u7684\u5b57\u6bb5\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"font-size:12px\">\u4e0b\u9762\u6211\u4eec\u5c31\u6765\u770b\u770bPresto SQL\u4e2d\u590d\u6742\u5206\u7ec4\u64cd\u4f5c\u7684\u5177\u4f53\u5b9e\u73b0\uff0c\u5047\u8bbe\u6211\u4eec\u6709\u5982\u4e0b\u6570\u636e\u8868table1\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/10\/\u7ed9group-by\u6dfb\u52a0\u6c47\u603b\u884c2.png\" alt=\"\" class=\"wp-image-552\" width=\"339\" height=\"360\" srcset=\"https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/10\/\u7ed9group-by\u6dfb\u52a0\u6c47\u603b\u884c2.png 677w, https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/10\/\u7ed9group-by\u6dfb\u52a0\u6c47\u603b\u884c2-282x300.png 282w\" sizes=\"auto, (max-width: 339px) 100vw, 339px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"font-size:12px\"><strong>\u793a\u4f8b\u4ee3\u78011\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"sql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">--grouping sets\u8bed\u6cd5\nselect\n    product,\n    sum(amount) as amount\nfrom table1\ngroup by grouping sets((product))\norder by 1;\n\n\nselect\n    category,\n    product,\n    sum(amount) as amount\nfrom table1\ngroup by grouping sets((category), (category, product), (product))\norder by 1,2;<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"font-size:12px\"><strong>\u4ee3\u7801\u7ed3\u679c1\uff1a<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/10\/\u7ed9group-by\u6dfb\u52a0\u6c47\u603b\u884c3.png\" alt=\"\" class=\"wp-image-553\" width=\"144\" height=\"101\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/10\/\u7ed9group-by\u6dfb\u52a0\u6c47\u603b\u884c4.png\" alt=\"\" class=\"wp-image-554\" width=\"209\" height=\"207\" srcset=\"https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/10\/\u7ed9group-by\u6dfb\u52a0\u6c47\u603b\u884c4.png 418w, https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/10\/\u7ed9group-by\u6dfb\u52a0\u6c47\u603b\u884c4-300x296.png 300w, https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/10\/\u7ed9group-by\u6dfb\u52a0\u6c47\u603b\u884c4-150x150.png 150w, https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/10\/\u7ed9group-by\u6dfb\u52a0\u6c47\u603b\u884c4-304x300.png 304w\" sizes=\"auto, (max-width: 209px) 100vw, 209px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"font-size:12px\"><strong>\u793a\u4f8b\u4ee3\u78012\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"sql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">--cube\u8bed\u6cd5\nselect\n    category,\n    product,\n    sum(amount) as amount\nfrom table1\ngroup by cube(category, product)  --\u76f8\u5f53\u4e8egrouping sets((category), (category, product), (product), ())\norder by 1,2;<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"font-size:12px\"><strong>\u4ee3\u7801\u7ed3\u679c2\uff1a<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/10\/\u7ed9group-by\u6dfb\u52a0\u6c47\u603b\u884c5.png\" alt=\"\" class=\"wp-image-555\" width=\"209\" height=\"225\" srcset=\"https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/10\/\u7ed9group-by\u6dfb\u52a0\u6c47\u603b\u884c5.png 418w, https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/10\/\u7ed9group-by\u6dfb\u52a0\u6c47\u603b\u884c5-279x300.png 279w\" sizes=\"auto, (max-width: 209px) 100vw, 209px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"font-size:12px\"><strong>\u793a\u4f8b\u4ee3\u78013\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"sql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">--rollup\u8bed\u6cd5\nselect\n    category,\n    product,\n    sum(amount) as amount\nfrom table1\ngroup by rollup(category, product)  --\u76f8\u5f53\u4e8egrouping sets(category, (category, product), ())\norder by 1,2;<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"font-size:12px\"><strong>\u4ee3\u7801\u7ed3\u679c3\uff1a<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/10\/\u7ed9group-by\u6dfb\u52a0\u6c47\u603b\u884c6.png\" alt=\"\" class=\"wp-image-556\" width=\"209\" height=\"171\" srcset=\"https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/10\/\u7ed9group-by\u6dfb\u52a0\u6c47\u603b\u884c6.png 418w, https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/10\/\u7ed9group-by\u6dfb\u52a0\u6c47\u603b\u884c6-300x245.png 300w, https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/10\/\u7ed9group-by\u6dfb\u52a0\u6c47\u603b\u884c6-367x300.png 367w\" sizes=\"auto, (max-width: 209px) 100vw, 209px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"font-size:12px\"><strong>\u793a\u4f8b\u4ee3\u78014\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"sql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">--\u4e0d\u80fd\u4f7f\u7528\u8868\u8fbe\u5f0f,\u53ea\u80fd\u5148\u65b0\u5efa\u5b57\u6bb5\nwith\n    tmp as (\n        select\n            category,\n            product,\n            to_char(time, 'yyyy-mm') as month,\n            amount\n        from table1\n    )\nselect\n    category,\n    product,\n    month,\n    sum(amount) as amount\nfrom tmp\ngroup by rollup(category, product, month)  --month\u4e0d\u80fd\u76f4\u63a5\u4f7f\u7528to_char(time, 'yyyy-mm')\norder by 1,2,3;<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"font-size:12px\"><strong>\u4ee3\u7801\u7ed3\u679c4\uff1a<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/10\/\u7ed9group-by\u6dfb\u52a0\u6c47\u603b\u884c7.png\" alt=\"\" class=\"wp-image-557\" width=\"275\" height=\"471\" srcset=\"https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/10\/\u7ed9group-by\u6dfb\u52a0\u6c47\u603b\u884c7.png 549w, https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/10\/\u7ed9group-by\u6dfb\u52a0\u6c47\u603b\u884c7-175x300.png 175w\" sizes=\"auto, (max-width: 275px) 100vw, 275px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"font-size:12px\"><strong>\u793a\u4f8b\u4ee3\u78015\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"sql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">--\u5c06\u6c47\u603b\u884c\u7684\u5b57\u6bb5\u503c\u586b\u5145\u4e3a\u6c47\u603b\nwith\n    tmp as (\n        select\n            category,\n            product,\n            sum(amount) as amount\n        from table1\n        group by rollup(category, product)\n    )\nselect\n    if(category is null, '\u6c47\u603b', category) as category,\n    if(product is null, '\u6c47\u603b', product) as product,\n    amount\nfrom tmp\norder by 1,2;<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"font-size:12px\"><strong>\u4ee3\u7801\u7ed3\u679c5\uff1a<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/10\/\u7ed9group-by\u6dfb\u52a0\u6c47\u603b\u884c8.png\" alt=\"\" class=\"wp-image-558\" width=\"209\" height=\"171\" srcset=\"https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/10\/\u7ed9group-by\u6dfb\u52a0\u6c47\u603b\u884c8.png 418w, https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/10\/\u7ed9group-by\u6dfb\u52a0\u6c47\u603b\u884c8-300x245.png 300w, https:\/\/www.dataisfun.cn\/wp-content\/uploads\/2021\/10\/\u7ed9group-by\u6dfb\u52a0\u6c47\u603b\u884c8-367x300.png 367w\" sizes=\"auto, (max-width: 209px) 100vw, 209px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"font-size:12px\"><br>\u4ee5\u4e0a\u5c31\u662fPresto SQL\u4e3agroup by\u63d0\u4f9b\u76843\u79cd\u590d\u6742\u5206\u7ec4\u64cd\u4f5c\u7684\u5b9e\u73b0\uff0c\u5728\u9700\u8981\u4f7f\u7528union all\u5b9e\u73b0\u4e0d\u540c\u5206\u7ec4\u64cd\u4f5c\u65f6\uff0c\u6bd4\u5982\u9700\u8981\u7ed9group by\u6dfb\u52a0\u6c47\u603b\u884c\u65f6\uff0c\u53ef\u4ee5\u8003\u8651\u9009\u7528\u8fd93\u79cd\u8bed\u6cd5\u3002 <\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u719f\u6089Excel\u6570\u636e\u900f\u89c6\u8868\u7684\u540c\u5b66\u90fd\u77e5\u9053\uff0cExcel\u6570\u636e\u900f\u89c6\u8868\u53ef\u9009\u62e9\u663e\u793a\u5206\u7c7b\u6c47\u603b\uff0c\u5982\u4e0b\u56fe\u6240\u793a\uff1a \u4e00\u4e9b\u56fa\u5316&hellip; <a href=\"https:\/\/www.dataisfun.cn\/?p=494\" class=\"more-link read-more\" rel=\"bookmark\">\u7ee7\u7eed\u9605\u8bfb <span class=\"screen-reader-text\">Presto SQL-\u7ed9group by\u6dfb\u52a0\u6c47\u603b\u884c<\/span><i class=\"fa fa-arrow-right\"><\/i><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[9,6],"class_list":["post-494","post","type-post","status-publish","format-standard","hentry","category-sql","tag-presto","tag-sql","h-entry","h-as-article"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v19.11 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>group by\u6dfb\u52a0\u6c47\u603b\u884c | Presto SQL group by\u6dfb\u52a0\u6c47\u603b\u884c - \u6570\u636e\u597d\u73a9<\/title>\n<meta name=\"description\" content=\"\u4e00\u4e9b\u56fa\u5316\u7684\u8868\u683c\u578b\u62a5\u8868\u53ef\u80fd\u9700\u8981\u6709\u6c47\u603b\u884c\uff0c\u4ee5\u4fbf\u76f4\u63a5\u4f7f\u7528\u800c\u4e0d\u9700\u8981\u518d\u5728Excel\u4e2d\u52a0\u5de5\u8c03\u6574\u3002\u4e00\u4e9b\u62a5\u544a\u7528\u7684\u6570\u636e\u53ef\u80fd\u65e2\u9700\u8981\u5206\u7c7b\u6570\u636e\u4e5f\u9700\u8981\u6c47\u603b\u6570\u636e\uff0c\u5982\u679c\u80fd\u4e00\u6b21\u6027\u52a0\u5de5\u51fa\u6765\uff0c\u6548\u7387\u81ea\u7136\u66f4\u9ad8\u3002\u7ed9group by\u6dfb\u52a0\u6c47\u603b\u884c\uff0cPresto SQL\u4e3a\u6b64\u63d0\u4f9b\u4e863\u79cd\u8bed\u6cd5\uff1a\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dataisfun.cn\/?p=494\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"group by\u6dfb\u52a0\u6c47\u603b\u884c | Presto SQL group by\u6dfb\u52a0\u6c47\u603b\u884c - \u6570\u636e\u597d\u73a9\" \/>\n<meta property=\"og:description\" content=\"\u4e00\u4e9b\u56fa\u5316\u7684\u8868\u683c\u578b\u62a5\u8868\u53ef\u80fd\u9700\u8981\u6709\u6c47\u603b\u884c\uff0c\u4ee5\u4fbf\u76f4\u63a5\u4f7f\u7528\u800c\u4e0d\u9700\u8981\u518d\u5728Excel\u4e2d\u52a0\u5de5\u8c03\u6574\u3002\u4e00\u4e9b\u62a5\u544a\u7528\u7684\u6570\u636e\u53ef\u80fd\u65e2\u9700\u8981\u5206\u7c7b\u6570\u636e\u4e5f\u9700\u8981\u6c47\u603b\u6570\u636e\uff0c\u5982\u679c\u80fd\u4e00\u6b21\u6027\u52a0\u5de5\u51fa\u6765\uff0c\u6548\u7387\u81ea\u7136\u66f4\u9ad8\u3002\u7ed9group by\u6dfb\u52a0\u6c47\u603b\u884c\uff0cPresto SQL\u4e3a\u6b64\u63d0\u4f9b\u4e863\u79cd\u8bed\u6cd5\uff1a\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dataisfun.cn\/?p=494\" \/>\n<meta property=\"og:site_name\" content=\"\u6570\u636e\u597d\u73a9\" \/>\n<meta property=\"article:published_time\" content=\"2021-10-08T13:20:43+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-10-10T12:58:36+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.dataisfun.cn\/?p=494\",\"url\":\"https:\/\/www.dataisfun.cn\/?p=494\",\"name\":\"group by\u6dfb\u52a0\u6c47\u603b\u884c | Presto SQL group by\u6dfb\u52a0\u6c47\u603b\u884c - \u6570\u636e\u597d\u73a9\",\"isPartOf\":{\"@id\":\"https:\/\/www.dataisfun.cn\/#website\"},\"datePublished\":\"2021-10-08T13:20:43+00:00\",\"dateModified\":\"2021-10-10T12:58:36+00:00\",\"author\":{\"@id\":\"https:\/\/www.dataisfun.cn\/#\/schema\/person\/026bc03694bbf1608ccc639fb31c3293\"},\"description\":\"\u4e00\u4e9b\u56fa\u5316\u7684\u8868\u683c\u578b\u62a5\u8868\u53ef\u80fd\u9700\u8981\u6709\u6c47\u603b\u884c\uff0c\u4ee5\u4fbf\u76f4\u63a5\u4f7f\u7528\u800c\u4e0d\u9700\u8981\u518d\u5728Excel\u4e2d\u52a0\u5de5\u8c03\u6574\u3002\u4e00\u4e9b\u62a5\u544a\u7528\u7684\u6570\u636e\u53ef\u80fd\u65e2\u9700\u8981\u5206\u7c7b\u6570\u636e\u4e5f\u9700\u8981\u6c47\u603b\u6570\u636e\uff0c\u5982\u679c\u80fd\u4e00\u6b21\u6027\u52a0\u5de5\u51fa\u6765\uff0c\u6548\u7387\u81ea\u7136\u66f4\u9ad8\u3002\u7ed9group by\u6dfb\u52a0\u6c47\u603b\u884c\uff0cPresto SQL\u4e3a\u6b64\u63d0\u4f9b\u4e863\u79cd\u8bed\u6cd5\uff1a\",\"breadcrumb\":{\"@id\":\"https:\/\/www.dataisfun.cn\/?p=494#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.dataisfun.cn\/?p=494\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.dataisfun.cn\/?p=494#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.dataisfun.cn\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Presto SQL-\u7ed9group by\u6dfb\u52a0\u6c47\u603b\u884c\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.dataisfun.cn\/#website\",\"url\":\"https:\/\/www.dataisfun.cn\/\",\"name\":\"\u6570\u636e\u597d\u73a9\",\"description\":\"\u6570\u4e2d\u81ea\u6709\u4e7e\u5764\uff0c\u4e8e\u4e50\u8da3\u4e2d\u53d1\u73b0\u4ef7\u503c\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.dataisfun.cn\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.dataisfun.cn\/#\/schema\/person\/026bc03694bbf1608ccc639fb31c3293\",\"name\":\"admin\",\"sameAs\":[\"http:\/\/www.dataisfun.cn\"],\"url\":\"https:\/\/www.dataisfun.cn\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"group by\u6dfb\u52a0\u6c47\u603b\u884c | Presto SQL group by\u6dfb\u52a0\u6c47\u603b\u884c - \u6570\u636e\u597d\u73a9","description":"\u4e00\u4e9b\u56fa\u5316\u7684\u8868\u683c\u578b\u62a5\u8868\u53ef\u80fd\u9700\u8981\u6709\u6c47\u603b\u884c\uff0c\u4ee5\u4fbf\u76f4\u63a5\u4f7f\u7528\u800c\u4e0d\u9700\u8981\u518d\u5728Excel\u4e2d\u52a0\u5de5\u8c03\u6574\u3002\u4e00\u4e9b\u62a5\u544a\u7528\u7684\u6570\u636e\u53ef\u80fd\u65e2\u9700\u8981\u5206\u7c7b\u6570\u636e\u4e5f\u9700\u8981\u6c47\u603b\u6570\u636e\uff0c\u5982\u679c\u80fd\u4e00\u6b21\u6027\u52a0\u5de5\u51fa\u6765\uff0c\u6548\u7387\u81ea\u7136\u66f4\u9ad8\u3002\u7ed9group by\u6dfb\u52a0\u6c47\u603b\u884c\uff0cPresto SQL\u4e3a\u6b64\u63d0\u4f9b\u4e863\u79cd\u8bed\u6cd5\uff1a","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.dataisfun.cn\/?p=494","og_locale":"zh_CN","og_type":"article","og_title":"group by\u6dfb\u52a0\u6c47\u603b\u884c | Presto SQL group by\u6dfb\u52a0\u6c47\u603b\u884c - \u6570\u636e\u597d\u73a9","og_description":"\u4e00\u4e9b\u56fa\u5316\u7684\u8868\u683c\u578b\u62a5\u8868\u53ef\u80fd\u9700\u8981\u6709\u6c47\u603b\u884c\uff0c\u4ee5\u4fbf\u76f4\u63a5\u4f7f\u7528\u800c\u4e0d\u9700\u8981\u518d\u5728Excel\u4e2d\u52a0\u5de5\u8c03\u6574\u3002\u4e00\u4e9b\u62a5\u544a\u7528\u7684\u6570\u636e\u53ef\u80fd\u65e2\u9700\u8981\u5206\u7c7b\u6570\u636e\u4e5f\u9700\u8981\u6c47\u603b\u6570\u636e\uff0c\u5982\u679c\u80fd\u4e00\u6b21\u6027\u52a0\u5de5\u51fa\u6765\uff0c\u6548\u7387\u81ea\u7136\u66f4\u9ad8\u3002\u7ed9group by\u6dfb\u52a0\u6c47\u603b\u884c\uff0cPresto SQL\u4e3a\u6b64\u63d0\u4f9b\u4e863\u79cd\u8bed\u6cd5\uff1a","og_url":"https:\/\/www.dataisfun.cn\/?p=494","og_site_name":"\u6570\u636e\u597d\u73a9","article_published_time":"2021-10-08T13:20:43+00:00","article_modified_time":"2021-10-10T12:58:36+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.dataisfun.cn\/?p=494","url":"https:\/\/www.dataisfun.cn\/?p=494","name":"group by\u6dfb\u52a0\u6c47\u603b\u884c | Presto SQL group by\u6dfb\u52a0\u6c47\u603b\u884c - \u6570\u636e\u597d\u73a9","isPartOf":{"@id":"https:\/\/www.dataisfun.cn\/#website"},"datePublished":"2021-10-08T13:20:43+00:00","dateModified":"2021-10-10T12:58:36+00:00","author":{"@id":"https:\/\/www.dataisfun.cn\/#\/schema\/person\/026bc03694bbf1608ccc639fb31c3293"},"description":"\u4e00\u4e9b\u56fa\u5316\u7684\u8868\u683c\u578b\u62a5\u8868\u53ef\u80fd\u9700\u8981\u6709\u6c47\u603b\u884c\uff0c\u4ee5\u4fbf\u76f4\u63a5\u4f7f\u7528\u800c\u4e0d\u9700\u8981\u518d\u5728Excel\u4e2d\u52a0\u5de5\u8c03\u6574\u3002\u4e00\u4e9b\u62a5\u544a\u7528\u7684\u6570\u636e\u53ef\u80fd\u65e2\u9700\u8981\u5206\u7c7b\u6570\u636e\u4e5f\u9700\u8981\u6c47\u603b\u6570\u636e\uff0c\u5982\u679c\u80fd\u4e00\u6b21\u6027\u52a0\u5de5\u51fa\u6765\uff0c\u6548\u7387\u81ea\u7136\u66f4\u9ad8\u3002\u7ed9group by\u6dfb\u52a0\u6c47\u603b\u884c\uff0cPresto SQL\u4e3a\u6b64\u63d0\u4f9b\u4e863\u79cd\u8bed\u6cd5\uff1a","breadcrumb":{"@id":"https:\/\/www.dataisfun.cn\/?p=494#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dataisfun.cn\/?p=494"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.dataisfun.cn\/?p=494#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.dataisfun.cn\/"},{"@type":"ListItem","position":2,"name":"Presto SQL-\u7ed9group by\u6dfb\u52a0\u6c47\u603b\u884c"}]},{"@type":"WebSite","@id":"https:\/\/www.dataisfun.cn\/#website","url":"https:\/\/www.dataisfun.cn\/","name":"\u6570\u636e\u597d\u73a9","description":"\u6570\u4e2d\u81ea\u6709\u4e7e\u5764\uff0c\u4e8e\u4e50\u8da3\u4e2d\u53d1\u73b0\u4ef7\u503c","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dataisfun.cn\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.dataisfun.cn\/#\/schema\/person\/026bc03694bbf1608ccc639fb31c3293","name":"admin","sameAs":["http:\/\/www.dataisfun.cn"],"url":"https:\/\/www.dataisfun.cn\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/www.dataisfun.cn\/index.php?rest_route=\/wp\/v2\/posts\/494","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dataisfun.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dataisfun.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dataisfun.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dataisfun.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=494"}],"version-history":[{"count":9,"href":"https:\/\/www.dataisfun.cn\/index.php?rest_route=\/wp\/v2\/posts\/494\/revisions"}],"predecessor-version":[{"id":562,"href":"https:\/\/www.dataisfun.cn\/index.php?rest_route=\/wp\/v2\/posts\/494\/revisions\/562"}],"wp:attachment":[{"href":"https:\/\/www.dataisfun.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=494"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dataisfun.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=494"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dataisfun.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=494"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}