分组统计

1. groups sets(field1,field2,field3, (field1,field2)) 样例如下:

    select dt,tenantCode,nvl(platform,'all') as platform,
    count(1) as uv_one
    from(
    select tenantCode,platform,dt,deviceId,count(deviceId) as pv from
    dw_stg.tmp_tg_user_behavior_day a
    group by tenantCode,platform,dt,deviceId
    having tenantCode is not null 
    and deviceId is not null
    --and count(deviceId) = 1 --浏览量为1的访客数
    )aa group by tenantCode,platform,dt
    grouping sets((dt,tenantCode), (dt,tenantCode,platform))

结果显示如下:

 

相关文章:

  • 2022-02-28
  • 2021-08-10
  • 2022-12-23
  • 2022-12-23
  • 2022-01-29
  • 2022-01-23
  • 2021-11-15
  • 2022-12-23
猜你喜欢
  • 2022-01-28
  • 2021-12-29
  • 2022-12-23
  • 2021-08-15
相关资源
相似解决方案