首页 > 其他 > 详细

clickhouse count

时间:2021-07-08 18:29:04      阅读:33      评论:0      收藏:0      [点我收藏+]

select
discountId,
count() as cnt
from _cw_distributed_db.upsf_ods_upb_tbl_market_activity_log_info_ulsp
where transDt >= ‘2021-07-03 00:00:00‘ AND transDt < ‘2021-07-04 00:00:00‘
group by discountId
order by cnt desc
LIMIT 100

select count(cnt)
from
(
select
discountId,
count() as cnt
from _cw_distributed_db.upsf_ods_upb_tbl_market_activity_log_info_ulsp
where transDt >= ‘2021-07-03 00:00:00‘ AND transDt < ‘2021-07-04 00:00:00‘
group by discountId
order by cnt desc
)
where cnt > 1000


select
count(discountId) as diCount,
countDistinct(cardNo) as cardNoCount,
countDistinct(mobile) as mobileCount,
countDistinct(userId) as userIdCount,
countDistinct(logId) as logIdCount
from _cw_distributed_db.upsf_ods_upb_tbl_market_activity_log_info_ulsp
where transDt >= ‘2021-07-03 00:00:00‘ AND transDt < ‘2021-07-04 00:00:00‘;

clickhouse count

原文:https://www.cnblogs.com/tonggc1668/p/14987038.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!