rollup 的汇总行和下面的总和不相等 是什么原因呢???

如果这都不算爱 如果这都不算爱 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
select decode(grouping(l.nareated), 1, '日期合计', to_char(l.nareated)) nareated,
count(distinct(case
when l.isindex = 0 then
l.userid
else
null
end)) viewpeople, -- 这个字段 汇总行和下面数据行总和不相等
count(distinct(case
when l.ischarge = 1 and l.msid is not null then
l.msid || l.productid
else
null
end)) bookpeople, -- 这个字段 汇总行和下面数据行总和不相等
sum(case
when l.isnewuser = 0 then
1
else
0
end) newusers,
sum(case
when l.isindex = 0 then
1
else
0
end) assces,
count(case
when l.ischarge = 1 and l.msid is not null then
l.userid
else
null
end) downs,
sum(case
when l.ischarge = 1 then
l.price
else
0
end) / 10 moneys
from t_wp_accesslog l, t_declare_dproduct p
where l.productid = p.productid
and l.msid is not null
and l.nareated between to_number('20080217') and to_number('20080218')
group by rollup(l.nareated)
order by nareated desc
-----------------------------------------------------------------------------------
结果如下:
NAREATED VIEWPEOPLE BOOKPEOPLE NEWUSERS ASSCES DOWNS MONEYS
日期合计 9288 3563 10732 24057 9695 19082
20080217 4659 1794 5202 11589 4514 8871.5
20080216 4989 1880 5530 12468 5181 10210.5
...全文

相关推荐

评论 4
收藏 已收藏
分享
返回顶部
如果这都不算爱
Oracle 17,133 成员 55,258 内容