>sql语法错误|限制0,25

1bqhqjot  于 2021-07-27  发布在  Java
关注(0)|答案(1)|浏览(353)

我的结构中有一个查询正在phpmyadmin中运行。我正在尝试为olap操作运行多维数据集查询,这是我的查询:

SELECT QUARTER, REGION, SUM(SALES)
FROM salestable
GROUP BY CUBE (QUARTER, REGION)

我也尝试过这个查询:

SELECT salestable.QUARTER, salestable.REGION, SUM(salestable.SALES)
FROM salestable
GROUP BY CUBE (salestable.QUARTER, salestable.REGION)

但它显示了这个错误:


# 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(QUARTER, REGION) LIMIT 0, 25' at line 3

我试图打开页面检查语法,但它显示页面未找到。

cedebl8k

cedebl8k1#

我不认为mysql支持 CUBE 作为一个 GROUP BY 修饰符,但您可以使用 WITH ROLLUP :

SELECT st.QUARTER, st.REGION, SUM(st.SALES)
FROM salestable st
GROUP BY st.QUARTER, st.REGION WITH ROLLUP;

相关问题