Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
MySql 支持 GROUP BY WITH ROLLUP 它将返回 group by 中 n 列的最后 x 的聚合,但不支持 GROUP BY WITH CUBE 获取 n 列的所有组合并获取聚合。
我可以通过合并 GROUP BY WITH ROLLUP 查询来模拟这一点,但是 MySql 正在多次实现我的子查询。我在大型子查询上使用 group by,所以这是次优的。有没有办法在没有临时表的情况下解决这个问题?
简短的回答:没有。
长答案:您可以安装一个支持 GROUP BY WITH CUBE 的开源数据仓库,它使用 Mysql 作为存储引擎,例如 Pentaho。