数据仓库服务 GAUSSDB(DWS)-ROLLUP

时间:2024-12-10 11:29:04

ROLLUP

MySQL中的group by column with rollup需要转换为 GaussDB (DWS)中的group by rollup (column);

输入示例

1
2
3
select id,product_id,count(1) from czb_account.equity_account_log
where id in (6957343,6957397,6957519,6957541,6957719)
group by 1, 2 with rollup;

输出示例

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
SELECT
  id,
  product_id,
  count(1)
FROM
  czb_account.equity_account_log
WHERE
  id IN (6957343, 6957397, 6957519, 6957541, 6957719)
GROUP BY
  ROLLUP(1, 2);
support.huaweicloud.com/tg-dws/dws_16_0183.html