【sql】top的问题
hive -e "
select
brand_code,
barndname_full,
item_third_cate_cd,
item_third_cate_name,
id1
from(
select
brand_code,
barndname_full,
item_third_cate_cd,
item_third_cate_name,
id1,
row_number() over(partition by brand_code,barndname_full order by id1 desc) rank
from
(select
brand_code,
barndname_full,
item_third_cate_cd,
item_third_cate_name,
count(*) as id1
from
gdm.table1
where
dt = '2018-12-13'
and sku_valid_flag = 1
and item_valid_flag = 1
and sku_status_cd = '3001'
group by
brand_code,
barndname_full,
item_third_cate_cd,
item_third_cate_name) t
) t1
where rank = 1
"