问题描述
我遇到一个问题,我试图创建一个新的“行”(不属于数据库的一部分),该行仅给我“计数”列的总和。我想知道这是否可能?
我尝试将SUM(count(cost)作为“产品总成本” OVER()AS Total_Count添加;但是这只是创建了一个新列,每行显示的总金额为550.00。我希望550.00位于底部作为该列的最终计数。
select product,count(cost) as 'total product cost'
from product_Table
where product_Tier = 'grocery'
and as_of_date = '8/13/2020'
Group By product
Results:
product total product cost
corn 250.00
tomatoes 300.00
SUM 550.00 <--trying to create a row like this.
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)