可以用这个SQL试试?
select /*+SET_VAR(new_planner_agg_stage=2)*/
product_code,
propertycode,
process_center_name,
p_platform_name,
dev_manager_name,
product_status_name,
distribution_available_stock,
purchase_qty_approve,
purchase_qty_unapprove,
shift_in_num,
unshift_num_approve,
weight,
labelname,
costprice,
product_name,
round(1.0 * SUM(sale_num_30), 6)
from
test
where
department_lv2 in ('电子平台')
group by
product_code,
propertycode,
process_center_name,
p_platform_name,
dev_manager_name,
product_status_name,
distribution_available_stock,
purchase_qty_approve,
purchase_qty_unapprove,
shift_in_num,
unshift_num_approve,
weight,
labelname,
costprice,
product_name
limit 30
另外,可以执行下面的sql看看有没有数据,没有的话可以analyze table test 一下
select * from table_statistic_v1 where table_name like "%test%";
或者也可以贴一下 explain costs + 你的sql的结果