我有汇总查询
char[] c = guess.toCharArray();
for (c : chars) {
charCount[c] -= 1;
if (charCount[c] < 0) {
return 0;
}
}
它返回最后一行NULL值不会给出总和善解决这个为什么我得到总无效
Actualy我正在使用连接和计算获得记录,如itemprice减去折扣,并按数量乘以现在在计算领域应用ROLLUP
答案 0 :(得分:1)
您需要select
中的聚合函数:
Select (CASE WHEN (GROUPING(p. product_name ) = 1) THEN 'Total'
ELSE p.product_name
END) AS ProductName,
sum((o.item_price - o.discount_amount )*o.quantity) as Total_Amount
from products p inner join
order_items o
on o.product_id = p.product_id
group by p.product_name with rollup;