hive sql 中,查询某个字段的取值总共有多少个类别,只需要count一下即可,但需要注意加distinct.
如查询表中符合条件的uuid总共有多少个类别(独立不重复的uuid 有多少)
-- 独立的uuid总数
select count(distinct(uuid))
from bigTable0111zw
where cre_mod in ('tianyi_npagev', 'tianyi_nspagev') and sni_info='7'
;
-- 结果输出 5993
distinct 关键词会对重复的内容进行去重。